写了一个自定义函数功能为程序运行时用鼠标移动控件的如下所是
procedure ManipulateControl(Control: TControl; Shift: TShiftState;
X, Y, Precision: integer);
begin
//光标在控件的客户区(移动整个控件)******************************************
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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;
1)小弟在程序运行时动态生成数十个StringGrid控件要模仿Visio用于工作流定义请问ManipulateControl函数怎样和StringGrid的onMouseMove事件绑定。2)小弟用canvas.moveto和canvas.Lineto画在StringGrid间的连线被拖动时经过的StrigGrid擦除经过后重绘太耗资源。有没有别的画线函数解决问题。谢谢
procedure ManipulateControl(Control: TControl; Shift: TShiftState;
X, Y, Precision: integer);
begin
//光标在控件的客户区(移动整个控件)******************************************
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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;
1)小弟在程序运行时动态生成数十个StringGrid控件要模仿Visio用于工作流定义请问ManipulateControl函数怎样和StringGrid的onMouseMove事件绑定。2)小弟用canvas.moveto和canvas.Lineto画在StringGrid间的连线被拖动时经过的StrigGrid擦除经过后重绘太耗资源。有没有别的画线函数解决问题。谢谢
procedure TForm1.Button1MouseDown(Sender: TObject, Shift: TShift,
Button: TButton; X, Y: Integer);
const
SC_DragMove = $012
begin
ReleaseCapture;
Perform(WM_SysCommand, SC_DragMove, 0);
end;