我有代码,它接收在服务器端之前已经定义的特定区域,并在客户端的Form上创建一个孔.而不是这样,我想要得到这个相同区域的屏幕截图,但是没有出现我的Form在最终的结果,像一个正常的桌面捕获,但在这种情况下只会被捕获,这个小区域.
那么,我可以如何调整我的这个代码呢?
procedure TForm1.CS1Read(Sender: TObject; Socket: TCustomWinSocket); var X1,X2,Y1,Y2: Integer; List: TStrings; FormRegion,HoleRegion: HRGN; StrCommand: String; begin StrCommand := Socket.ReceiveText; if Pos('§',StrCommand) > 0 then begin List := TStringList.Create; try FormRegion := CreateRectRgn(0,Form12.Width,Form12.Height); ExtractStrings(['§'],[],PChar(StrCommand),List); X1 := StrToIntDef(List[0],0) - Form12.Left - 2; Y1 := StrToIntDef(List[1],0) - Form12.Top - 2; X2 := StrToIntDef(List[2],0) - Form12.Left - 2; Y2 := StrToIntDef(List[3],0) - Form12.Top - 2; HoleRegion := CreateRectRgn(X1,Y2); CombineRgn(FormRegion,FormRegion,HoleRegion,RGN_DIFF); SetWindowRgn(Form12.Handle,True); finally List.Free; end; end; end;