clnMain.pas
资源名称:SimpleSC.rar [点击查看]
上传用户:juxian
上传日期:2013-04-01
资源大小:38k
文件大小:1k
源码类别:
驱动编程
开发平台:
Delphi
- unit clnMain;
- interface
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- ScrSpy;
- type
- TForm1 = class(TForm)
- ScreenPlayer1: TScreenPlayer;
- procedure ScreenPlayer1HeaderUpdate(Sender: TObject);
- procedure ScreenPlayer1ScreenBitmap(Sender: TObject;
- const Block: TScreenBlock);
- procedure FormResize(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- private
- { Private declarations }
- XRate, YRate: Extended;
- HasServer: Boolean;
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- implementation
- {$R *.DFM}
- procedure TForm1.ScreenPlayer1HeaderUpdate(Sender: TObject);
- begin
- HasServer:= True;
- XRate:= ClientWidth / ScreenPlayer1.ScreenWidth;
- YRate:= ClientHeight / ScreenPlayer1.ScreenHeight;
- end;
- procedure TForm1.ScreenPlayer1ScreenBitmap(Sender: TObject;
- const Block: TScreenBlock);
- Var
- R: TRect;
- begin
- R:= Rect(Round(Block.Bound.Left*XRate), Round(Block.Bound.Top*YRate), Round(Block.Bound.Right*XRate), Round(Block.Bound.Bottom*YRate));
- Canvas.StretchDraw(R, Block.BMP);
- end;
- procedure TForm1.FormResize(Sender: TObject);
- begin
- If HasServer then
- ScreenPlayer1HeaderUpdate(Sender);
- end;
- procedure TForm1.FormCreate(Sender: TObject);
- begin
- HasServer:= False;
- end;
- end.