UfrmCapture.pas
上传用户:hndmjx
上传日期:2014-09-16
资源大小:3369k
文件大小:2k
源码类别:

Delphi控件源码

开发平台:

Delphi

  1. unit UfrmCapture;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5.   Dialogs, ExtCtrls, StdCtrls,DM5314_UExplorer,DM5314_UCommandsAndUtils;
  6. type
  7.   TfrmCapture = class(TForm)
  8.     Label1: TLabel;
  9.     imgScreenshot: TImage;
  10.     Timer1: TTimer;
  11.     procedure Label1Click(Sender: TObject);
  12.     procedure imgScreenshotMouseMove(Sender: TObject; Shift: TShiftState;
  13.       X, Y: Integer);
  14.     procedure Timer1Timer(Sender: TObject);
  15.     procedure imgScreenshotMouseDown(Sender: TObject; Button: TMouseButton;
  16.       Shift: TShiftState; X, Y: Integer);
  17.   private
  18.     { Private declarations }
  19.   public
  20.     { Public declarations }
  21.   end;
  22. var
  23.   frmCapture: TfrmCapture;
  24.   MousePosX  ,MousePosY : integer;
  25.   Counter: integer;
  26. implementation
  27.  uses Mainform;
  28. {$R *.dfm}
  29. procedure TfrmCapture.Label1Click(Sender: TObject);
  30. begin
  31. frmCapture.Hide;
  32. timer1.Enabled:=false;
  33. frmMain.TimerRDC.Enabled:=false;
  34. end;
  35. procedure TfrmCapture.imgScreenshotMouseMove(Sender: TObject;
  36. Shift: TShiftState; X, Y: Integer);
  37. begin
  38. MousePosX:=X ;
  39. MousePosY:=Y;
  40. end;
  41. procedure TfrmCapture.Timer1Timer(Sender: TObject);
  42. var
  43. d : string;
  44. begin
  45.    if typeconnection=0 then   begin
  46. d :='^' +  inttostr(MousePosX) +'^' +  inttostr(MousePosY) + '^';
  47. frmMain.KClient.Send(pchar(d),length(d)) ;
  48.    end;
  49.      if typeconnection=1 then   begin
  50. d :='^' +  inttostr(MousePosX) +'^' +  inttostr(MousePosY) + '^';
  51. frmMain.KServer.Broadcast(pchar(d),length(d)) ;
  52.    end;
  53. end;
  54. procedure TfrmCapture.imgScreenshotMouseDown(Sender: TObject;
  55.   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  56.   var
  57. d : string;
  58. begin
  59. if timer1.Enabled=true then begin
  60. if typeconnection=0 then   begin
  61. d :='@' +  inttostr(MousePosX) + '@' +  inttostr(MousePosY) + '@';
  62. frmMain.KClient.Send(pchar(d),length(d)) ;
  63. end;
  64. if typeconnection=1 then   begin
  65. d :='@' +  inttostr(MousePosX) +'@' +  inttostr(MousePosY) + '@';
  66. frmMain.KServer.Broadcast(pchar(d),length(d)) ;
  67. end;
  68. end;
  69. end;
  70. end.