📄 showpic.pas
字号:
unit ShowPic;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, DynamicSkinForm, jpeg, Menus, SkinCtrls, SkinBoxCtrls,
StdCtrls, Mask, Buttons, ToolWin, ComCtrls, SkinMenus, Gauges, IdGlobal, LangFrm;
type
TShowPm = class(TLangForm)
spDynamicSkinForm1: TspDynamicSkinForm;
Panelbox: TspSkinPanel;
ClickTimer: TTimer;
ScrollBox1: TScrollBox;
spSkinSpeedButton2: TspSkinSpeedButton;
ControlBar1: TspSkinControlBar;
MainPanel: TspSkinPanel;
StatButton: TspSkinSpeedButton;
StopButton: TspSkinSpeedButton;
jianpanButton: TspSkinSpeedButton;
ShubiaoButton: TspSkinSpeedButton;
WinButton: TspSkinSpeedButton;
ShiftButton: TspSkinSpeedButton;
CtrlButton: TspSkinSpeedButton;
AltButton: TspSkinSpeedButton;
TobButton: TspSkinSpeedButton;
EscButton: TspSkinSpeedButton;
SaveDialog1: TSaveDialog;
PopupMenu1: TspSkinPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
SaveButton: TspSkinMenuButton;
Image1: TPaintBox;
Gauge1: TGauge;
ComboBox4: TspSkinComboBox;
procedure ClickTimerTimer(Sender: TObject);
procedure Image1DblClick(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormResize(Sender: TObject);
procedure StatButtonClick(Sender: TObject);
procedure StopButtonClick(Sender: TObject);
procedure ShiftButtonClick(Sender: TObject);
procedure CtrlButtonClick(Sender: TObject);
procedure AltButtonClick(Sender: TObject);
procedure TobButtonClick(Sender: TObject);
procedure EscButtonClick(Sender: TObject);
procedure WinButtonClick(Sender: TObject);
procedure N1Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure PaintBox1Click(Sender: TObject);
procedure PaintBox1DblClick(Sender: TObject);
procedure PaintBox1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure PaintBox1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure PaintBox1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Image1Paint(Sender: TObject);
procedure ComboBox4Change(Sender: TObject);
private
{ Private declarations }
LastX : integer;
LastY : integer;
but : integer;
NumClick : integer;
public
{ Public declarations }
end;
var
ShowPm: TShowPm;
implementation
uses
Main;
{$R *.dfm}
function IntToByteStr(Value: integer): string;
begin
SetLength(Result, 4);
Move(Value, Result[1], sizeof(integer));
end;
{procedure TShowPm.ScaleXY(var X, Y: integer);
begin
with Image1 do begin
X := X * Picture.Width div Width;
Y := Y * Picture.Height div Height;
end;
end; }
procedure TShowPm.ClickTimerTimer(Sender: TObject);
begin
ClickTimer.Enabled := False;
try
if (NumClick=1) and (but=1) then //单击左键
begin
HgzVip.ScrControl.Connection.Write(IntToByteStr(1)+IntToByteStr(LastX) + IntToByteStr(LastY)+ EOL);
end;
if (NumClick=2) and (but=1) then //双击左键
begin
HgzVip.ScrControl.Connection.Write(IntToByteStr(2)+IntToByteStr(LastX) + IntToByteStr(LastY)+ EOL);
end;
if (NumClick=1) and (but=2) then //单击右键
begin
HgzVip.ScrControl.Connection.Write(IntToByteStr(3)+IntToByteStr(LastX) + IntToByteStr(LastY)+ EOL);
end;
if (NumClick=2) and (but=2) then //双击左键
begin
HgzVip.ScrControl.Connection.Write(IntToByteStr(4)+IntToByteStr(LastX) + IntToByteStr(LastY)+ EOL);
end;
// HgzVip.AddLineStr(IntToByteStr(LastX) + IntToByteStr(LastY) +
// IntToByteStr(NumClick) + IntToByteStr(but),1,False);
except
end;
HgzVip.Enabled:=True;
end;
procedure TShowPm.Image1DblClick(Sender: TObject);
begin
if ShubiaoButton.Down then
begin
NumClick := 2;
ClickTimer.Enabled := True;
end;
end;
procedure TShowPm.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
try
if jianpanButton.Down then
begin
HgzVip.ScrControl.Connection.Write(IntToByteStr(10)+IntToByteStr(key) + IntToByteStr(10)+ EOL);
end;
except
end;
end;
procedure TShowPm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
try
jianpanButton.Down:=False;
ShubiaoButton.Down:=False;
StopButton.Down:=True;
HgzVip.ScreenCThread.Connection.Disconnect;
HgzVip.ScreenCThread.Terminate;
except
end;
try
HgzVip.ScrControl.Connection.Disconnect;
HgzVip.ScrControl.Terminate;
except
end;
HgzVip.ZhuDongCmdSend('004', '0', True);
end;
procedure TShowPm.FormResize(Sender: TObject);
begin
try
MainPanel.Width:= ShowPm.Width;
except
end;
end;
procedure TShowPm.StatButtonClick(Sender: TObject);
begin
HgzVip.ToolButtonButton6Click(Sender);
end;
procedure TShowPm.StopButtonClick(Sender: TObject);
begin
try
HgzVip.isBpok := False;
HgzVip.ScreenCThread.Connection.Disconnect;
HgzVip.ScreenCThread.Terminate;
except
end;
try
HgzVip.ScrControl.Connection.Disconnect;
HgzVip.ScrControl.Terminate;
except
end;
HgzVip.ZhuDongCmdSend('004', '0', True);
end;
procedure TShowPm.ShiftButtonClick(Sender: TObject);
begin
if not jianpanButton.Down then Exit;
try
if ShiftButton.Down then
begin
HgzVip.ScrControl.Connection.Write(IntToByteStr(6)+IntToByteStr(16) + IntToByteStr(6)+ EOL);
end else
begin
HgzVip.ScrControl.Connection.Write(IntToByteStr(7)+IntToByteStr(16) + IntToByteStr(6)+ EOL);
end;
except
end;
end;
procedure TShowPm.CtrlButtonClick(Sender: TObject);
begin
if not jianpanButton.Down then Exit;
try
if CtrlButton.Down then
begin
HgzVip.ScrControl.Connection.Write(IntToByteStr(6)+IntToByteStr(17) + IntToByteStr(6)+ EOL);
end else
begin
HgzVip.ScrControl.Connection.Write(IntToByteStr(7)+IntToByteStr(17) + IntToByteStr(7)+ EOL);
end;
except
end;
end;
procedure TShowPm.AltButtonClick(Sender: TObject);
begin
if not jianpanButton.Down then Exit;
try
if AltButton.Down then
begin
HgzVip.ScrControl.Connection.Write(IntToByteStr(6)+IntToByteStr(18) + IntToByteStr(6)+ EOL);
end else
begin
HgzVip.ScrControl.Connection.Write(IntToByteStr(7)+IntToByteStr(18) + IntToByteStr(7)+ EOL);
end;
except
end;
end;
procedure TShowPm.TobButtonClick(Sender: TObject);
begin
if not jianpanButton.Down then Exit;
try
HgzVip.ScrControl.Connection.Write(IntToByteStr(8)+IntToByteStr(8) + IntToByteStr(8)+ EOL);
except
end;
end;
procedure TShowPm.EscButtonClick(Sender: TObject);
begin
if not jianpanButton.Down then Exit;
try
HgzVip.ScrControl.Connection.Write(IntToByteStr(9)+IntToByteStr(9) + IntToByteStr(9)+ EOL);
except
end;
end;
procedure TShowPm.WinButtonClick(Sender: TObject);
begin
if not jianpanButton.Down then Exit;
try
HgzVip.ScrControl.Connection.Write(IntToByteStr(5)+IntToByteStr(5) + IntToByteStr(5)+ EOL);
except
end;
end;
procedure TShowPm.N1Click(Sender: TObject);
begin
try
if SaveDialog1.Execute then
begin
HgzVip.FDoubleBuffer.SaveToFile(SaveDialog1.FileName);
end;
except
end;
end;
procedure TShowPm.N2Click(Sender: TObject);
begin
N2.Checked:=not N2.Checked;
end;
procedure TShowPm.PaintBox1Click(Sender: TObject);
begin
if ShubiaoButton.Down then
begin
NumClick := 1;
ClickTimer.Enabled := False;
ClickTimer.Enabled := True;
end;
end;
procedure TShowPm.PaintBox1DblClick(Sender: TObject);
begin
if ShubiaoButton.Down then
begin
NumClick := 2;
ClickTimer.Enabled := False;
ClickTimer.Enabled := True;
end;
end;
procedure TShowPm.PaintBox1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if ShubiaoButton.Down then
begin
but := 1;
if Button = mbRight then but := 2;
//HgzVip.ZhuDongCmdSend('015',IntToStr(X) + IntToStr(Y)+ IntToStr(but),-1);
end;
//HgzVip.AddLineStr(inttostr(X) +' '+ inttostr(Y),1,False);
end;
procedure TShowPm.PaintBox1MouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
begin
if ShubiaoButton.Down then
begin
LastX := X;
LastY := Y;
try
HgzVip.ScrControl.Connection.Write(IntToByteStr(0)+IntToByteStr(LastX) + IntToByteStr(LastY)+ EOL);
except
end;
//HgzVip.AddLineStr(inttostr(X) +' '+ inttostr(Y),1,False);
end;
end;
procedure TShowPm.PaintBox1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if ShubiaoButton.Down then
begin
if but = 2 then
begin //单击右键
HgzVip.ScrControl.Connection.Write(IntToByteStr(3)+IntToByteStr(LastX) + IntToByteStr(LastY)+ EOL);
end;
end;
// HgzVip.AddLineStr(inttostr(X) +' '+ inttostr(Y),1,False);
end;
procedure TShowPm.Image1Paint(Sender: TObject);
begin
try
if (Image1.Width<>HgzVip.FDoubleBuffer.Width)
or (Image1.Height <> HgzVip.FDoubleBuffer.Height) then
begin
Image1.Top:=0;
Image1.Left:=0;
Image1.Width := HgzVip.FDoubleBuffer.Width;
Image1.Height := HgzVip.FDoubleBuffer.Height;
end;
Image1.Canvas.Draw(0, 0, HgzVip.FDoubleBuffer);
except
end;
end;
procedure TShowPm.ComboBox4Change(Sender: TObject);
begin
HgzVip.ZhuDongCmdSend('079',InttoStr(ComboBox4.ItemIndex), True);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -