1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
unit ZooShaiVCL_ChildMDI;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.StdCtrls, Vcl.Buttons;
type
TZooShaiVCLChildMDIForm = class(TForm)
btn1: TBitBtn;
btn2: TBitBtn;
Memo1: TMemo;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Déclarations privées }
RegionRondeCumul: HRGN; // Où est le trou dans mon Frooomage ...
public
{ Déclarations publiques }
end;
implementation
{$R *.dfm}
procedure TZooShaiVCLChildMDIForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caFree;
end;
procedure TZooShaiVCLChildMDIForm.FormCreate(Sender: TObject);
(* bord *) //var
(* bord *) //RegionWnd: HRGN;
begin
Randomize();
RegionRondeCumul := CreateRectRgn(0, 0, 0, 0);
(* bord *) //RegionWnd := CreateRectRgn(Width-ClientWidth, Height-ClientHeight, ClientWidth, ClientHeight);
(* bord *) //CombineRgn(RegionWnd, RegionWnd, RegionRondeCumul, RGN_DIFF);
(* bord *) //SetWindowRgn(Self.Handle, RegionWnd, Visible);
Color := clInfoBk;
end;
procedure TZooShaiVCLChildMDIForm.FormDestroy(Sender: TObject);
begin
DeleteObject(RegionRondeCumul);
end;
procedure TZooShaiVCLChildMDIForm.FormClick(Sender: TObject);
var
RegionRonde: HRGN;
RegionWnd: HRGN;
R: Integer;
PM: TPoint;
begin
if GetCursorPos(PM) then
begin
PM := Self.ScreenToClient(PM);
// Une Région en forme d'un Rond
R := Random(50);
RegionRonde := CreateEllipticRgn(PM.X-R, PM.Y-R, PM.X+R, PM.Y+R);
CombineRgn(RegionRondeCumul, RegionRondeCumul, RegionRonde, RGN_OR);
(* bord *) //RegionWnd := CreateRectRgn(Width-ClientWidth, Height-ClientHeight, ClientWidth, ClientHeight);
(* tout*) (*//*)RegionWnd := CreateRectRgn(0, 0, Width, Height);
CombineRgn(RegionWnd, RegionWnd, RegionRondeCumul, RGN_DIFF);
SetWindowRgn(Self.Handle, RegionWnd, Visible);
// Ne pas faire de DeleteObject(RegionClient)
// Aide de SetWindowRgn : With SetWindowRgn, do not close this region handle.
// On oublie les Regions de Calcul
DeleteObject(RegionRonde);
end;
end;
end. |
Partager