苦苦寻找:在一个控件上能用鼠标拉一个框,框能用鼠标拉大或拉小或移动,框里能显示动画图片或文字等内容
RT
[解决办法]
找毛的控件呀,自己做一个,没什么难的
[解决办法]
不是所有事别人多能帮你,关键还是要自己去研究学习
[解决办法]
什么一定要找控件呢?
你自己一小程序,看是否可以似功能?
[解决办法]
[解决办法]
一个TPAINTBOX,外加鼠标控制事件不就可以了
[解决办法]
给你一个思路:
- Delphi(Pascal) code
任意的拖动窗口procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);begin ReleaseCapture; Perform(WM_SYSCOMMAND,$f012,0);end;实际上,可以封装一下上面的代码,这样以后只要在控件的MouseMown中调用下面的函数就可以实现运行的时候拖动和改变控件的大小:procedure DragControl(WinControl:TWinControl);const SM=$F012;begin ReleaseCapture; WinControl.Perform(WM_SYSCOMMAND,SM,0);end;其中,$F012可以从$F000变换到$F012,其含义分别如下:$F000:哎,自己测试吧! *********************************<<Delphi 淡手辑略之控件篇>>闪亮登场,掌声..... //==============================================================================//任意摆布一个控件(拖动、放大、缩小)******************************************//==============================================================================procedure ManipulateControl(Control: TControl; Shift: TShiftState; X, Y, Precision: integer);var SC_MANIPULATE: Word;begin //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //光标在控件的最左侧********************************************************** //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if (X<=Precision) and (Y>Precision) and (Y<Control.Height-Precision) then begin SC_MANIPULATE := $F001; Control.Cursor := crSizeWE; end //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //光标在控件的最右侧********************************************************** //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ else if (X>=Control.Width-Precision) and (Y>Precision) and (Y<Control.Height-Precision) then begin SC_MANIPULATE := $F002; Control.Cursor := crSizeWE; end //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //光标在控件的最上侧********************************************************** //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ else if (X>Precision) and (X<Control.Width-Precision) and (Y<=Precision) then begin SC_MANIPULATE := $F003; Control.Cursor := crSizeNS; end //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //光标在控件的左上角********************************************************** //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ else if (X<=Precision) and (Y<=Precision) then begin SC_MANIPULATE := $F004; Control.Cursor := crSizeNWSE; end //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //光标在控件的右上角********************************************************** //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ else if (X>=Control.Width-Precision) and (Y<=Precision) then begin SC_MANIPULATE := $F005; Control.Cursor := crSizeNESW ; end //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //光标在控件的最下侧********************************************************** //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ else if (X>Precision) and (X<Control.Width-Precision) and (Y>=Control.Height-Precision) then begin SC_MANIPULATE := $F006; Control.Cursor := crSizeNS; end //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //光标在控件的左下角********************************************************** //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ else if (X<=Precision) and (Y>=Control.Height-Precision) then begin SC_MANIPULATE := $F007; Control.Cursor := crSizeNESW; end //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //光标在控件的右下角********************************************************** //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ else if (X>=Control.Width-Precision) and (Y>=Control.Height-Precision) then begin SC_MANIPULATE := $F008; Control.Cursor := crSizeNWSE; end //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //光标在控件的客户区(移动整个控件)****************************************** //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ else if (X>5) and (Y>5) and (X<Control.Width-5) and (Y<Control.Height-5) then begin SC_MANIPULATE := $F009; Control.Cursor := crSizeAll; end else begin SC_MANIPULATE := $F000; Control.Cursor := crDefault; end; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if Shift=[ssLeft] then begin ReleaseCapture; Control.Perform(WM_SYSCOMMAND, SC_MANIPULATE, 0); end; end;