您的位置:程序门 -> c++ builder -> 基础类



拷贝和粘贴命令


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


拷贝和粘贴命令[已结贴,结贴人:rockcmc2000]
发表于:2007-03-13 13:40:21 楼主
程序运行后,,点一下新建,,在界面上会生产一个image,再在点新建又会生产一个image。
任何实现
(程序没运行前,,form没有image)
发表于:2007-03-13 13:48:141楼 得分:0
动态创建控件?
发表于:2007-03-13 13:59:092楼 得分:0
请各位老大给个例程,,
发表于:2007-03-13 14:00:323楼 得分:20
static   int   imgid   =   0;
        static   int   ntoptemp   =   0   ;
        imgid   +=   1;
        ntoptemp   +=   30   ;//控件的top坐标
        ansistring   strname             =   "img "+inttostr(imgid);//构成不重复的名称
        //
        timage   *pnl                       =   new   timage(this);
        pnl-> name                       =   "duan "   +   inttostr(imgid)   ;
        pnl-> parent   =   this   ;
        pnl-> top   =   ntoptemp   ;

        pnl-> canvas-> brush-> color   =   clred;

                ntoptemp   +=   80   ;   这个代码放在按钮里
发表于:2007-03-13 14:00:564楼 得分:0
把上面这段代码放在按钮里执行就可以了
发表于:2007-03-13 14:31:245楼 得分:0
谢谢winner8080(志在云天)
  再问一下,如果我想用鼠标右键拖动新创建的图
bool       bmousedown       =       false;      
    int       ix,iy;      

    void       __fastcall       tform1::image1mousedown(tobject       *sender,      
                            tmousebutton       button,       tshiftstate       shift,       int       x,       int       y)      
    {     if(button==mbright)

                    ix       =       x;      
                    iy       =       y;      
                    bmousedown       =       true;      
    }      
    //---------------------------------------------------------------------------      
       
    void       __fastcall       tform1::image1mouseup(tobject       *sender,       tmousebutton       button,      
                            tshiftstate       shift,       int       x,       int       y)      
    {      
                    bmousedown       =       false;                      
    }      
    //---------------------------------------------------------------------------      
    void       __fastcall       tform1::image1mousemove(tobject       *sender,       tshiftstate       shift,      
                            int       x,       int       y)      
    {      
                    if(bmousedown)      
                    {           doublebuffered       =       true;
                                    image1-> left       =       image1-> left       +       x       -       ix;      
                                    image1-> top           =       image1-> top       +       y       -       iy;      
                    }      

但是好像不是成功,,有时左键也起作用。
发表于:2007-03-13 14:57:556楼 得分:0
你看看image支持鼠标捕获吗
我当初也做过一个自定义报告的东西,
当时我是用自己写的panel类来模拟的image,当时我忘了为什么不用image了,肯定是不合适我才换的
用户自己设计报告,到时我解析出来,如果是panel就生产一个真正的image
发表于:2007-03-13 15:11:177楼 得分:0
先谢谢你


快速检索

最新资讯
热门点击