扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
procedure CursorControl(Control: TControl; Shift: TShiftState; X, Y, Prec: integer); begin //光标在控件的最左侧 if (X<=Prec) and (Y>Prec) and (Y<Control.Height-Prec) then Control.Cursor := crSizeWE // 光标在控件的最右侧 else if (X>=Control.Width-Prec) and (Y>Prec) and (Y<Control.Height-Prec) then Control.Cursor := crSizeWE // 光标在控件的最上侧 else if (X>Prec) and (X<Control.Width-Prec) and (Y<=Prec) then Control.Cursor := crSizeNS // 光标在控件的左上角 else if (X<=Prec) and (Y<=Prec) then Control.Cursor := crSizeNWSE // 光标在控件的右上角 else if (X>=Control.Width-Prec) and (Y<=Prec) then Control.Cursor := crSizeNESW // 光标在控件的最下侧 else if (X>Prec) and (X<Control.Width-Prec) and (Y>=Control.Height-Prec) then Control.Cursor := crSizeNS // 光标在控件的左下角 else if (X<=Prec) and (Y>=Control.Height-Prec) then Control.Cursor := crSizeNESW // 光标在控件的右下角 else if (X>=Control.Width-Prec) and (Y>=Control.Height-Prec) then Control.Cursor := crSizeNWSE // 光标在控件的客户区(移动整个控件) else if (X>5) and (Y>5) and (X<Control.Width-5) and (Y<Control.Height-5) then Control.Cursor := crSizeAll else Control.Cursor := crDefault;//恢复默认光标 end; |
procedure ManipulateControl(Control: TControl; Shift: TShiftState; X, Y, Prec: integer); var SC_MANIPULATE: Word;//保存对应消息值 begin // 光标在控件的最左侧 if (X<=Prec) and (Y>Prec) and (Y<Control.Height-Prec) then SC_MANIPULATE := $F001 // 光标在控件的最右侧 else if (X>=Control.Width-Prec) and (Y>Prec) and (Y<Control.Height-Prec) then SC_MANIPULATE := $F002 // 光标在控件的最上侧 else if (X>Prec) and (X<Control.Width-Prec) and (Y<=Prec) then begin SC_MANIPULATE := $F003 // 光标在控件的左上角 else if (X<=Prec) and (Y<=Prec) then SC_MANIPULATE := $F004 // 光标在控件的右上角 else if (X>=Control.Width-Prec) and (Y<=Prec) then SC_MANIPULATE := $F005 // 光标在控件的最下侧 else if (X>Prec) and (X<Control.Width-Prec) and (Y>=Control.Height-Prec) then SC_MANIPULATE := $F006 // 光标在控件的左下角 else if (X<=Prec) and (Y>=Control.Height-Prec) then SC_MANIPULATE := $F007 // 光标在控件的右下角 else if (X>=Control.Width-Prec) and (Y>=Control.Height-Prec) then SC_MANIPULATE := $F008 // 光标在控件的客户区 ( 移动整个控件 ) else if (X>5) and (Y>5) and (X<Control.Width-5) and (Y<Control.Height-5) then SC_MANIPULATE := $F009 else SC_MANIPULATE := $F000; if Shift=[ssLeft] then begin ReleaseCapture; Control.Perform(WM_SYSCOMMAND, SC_MANIPULATE, 0);//向控件发送改变光标消息 end; end; |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。