全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1190
推到 Plurk!
推到 Facebook!

如何讓 Mouse 粘著 Button 10秒

答題得分者是:banson1716
wenberg
一般會員


發表:6
回覆:15
積分:9
註冊:2002-12-26

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-01-13 16:14:28 IP:61.223.xxx.xxx 未訂閱
請問如何讓 Mouse 粘著 Button 10 秒後才移動 謝謝 發表人 - WENBERG 於 2003/01/13 18:08:57
Miles
尊榮會員


發表:27
回覆:662
積分:622
註冊:2002-07-12

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-01-13 17:48:55 IP:211.76.xxx.xxx 未訂閱
Hi wenberg兄您好, 試試這段:

放一顆Timer先設定好時間
MyRect : TRect;    procedure TForm1.Button1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
Var
 lpWRect: TRect;      // window coordinates
 lpCPoint: TPoint;    // cursor coordinates
begin
     {retrive the panel coordinates}
     GetWindowRect(Button1.Handle, lpWRect);         {retrive the cursor position}
     GetCursorPos(lpCPoint);         {display the cursor position in terms of the panel}
     Windows.ScreenToClient(Button1.Handle,lpCPoint);         {confine the cursor within the panel}
     lpWRect.Right := lpWRect.Left   1;
     lpWRect.Bottom := lpWRect.Top   1;
     ClipCursor(@lpWRect);
end;
//
//
//
procedure TForm1.Timer1Timer(Sender: TObject);
begin
   Timer1.Enabled := False;
   ClipCursor(@MyRect);
end;
//
//
//
procedure TForm1.FormCreate(Sender: TObject);
begin
   GetClipCursor(MyRect);
end;
//
//
//
procedure TForm1.Button2Click(Sender: TObject);
var lpWRect: TRect;      
begin
   Timer1.Enabled := True;
   GetWindowRect(Button1.Handle, lpWRect);
   ClipCursor(@lpWRect);
end;
我不是高手, 高手是正在銀幕前微笑的人.
------


我不是高手, 高手是正在銀幕前微笑的人.
banson1716
高階會員


發表:55
回覆:182
積分:167
註冊:2002-04-14

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-01-15 10:38:33 IP:61.223.xxx.xxx 未訂閱
function FunctionDetect (LibName, FuncName: String; var LibPointer: Pointer): boolean; var LibHandle: tHandle; begin  Result := false;  LibPointer := NIL;   if LoadLibrary(PChar(LibName)) = 0 then exit;   LibHandle := GetModuleHandle(PChar(LibName));   if LibHandle <> 0 then   begin    LibPointer := GetProcAddress(LibHandle, PChar(FuncName));    if LibPointer <> NIL then Result := true;   end; end;    procedure TForm1.Button1Click(Sender: TObject); var xBlockInput : function (Block: BOOL): BOOL; stdcall; begin  if FunctionDetect ('USER32.DLL', 'BlockInput', @xBlockInput) then  begin   xBlockInput (True);      Sleep(3000);          xBlockInput (False);   end; end;  
引言: Mouse 粘著 Button 10 秒後才移動
系統時間:2024-05-13 19:29:49
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!