Forms that implement any shape in Delphi

zhaozj2021-02-08  251

Form's text:

object Form1: TForm1 Left = 192 Top = 107 BorderStyle = bsNone Caption = 'Form1' ClientHeight = 348 ClientWidth = 536 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans serif 'Font.Style = [] OldCreateOrder = False OnCreate = Button1Click PixelsPerInch = 96 TextHeight = 13 object Button1: TButton Left = 392 Top = 152 Width = 75 Height = 25 Caption =' Button1 'TabOrder = 0 OnClick = Button1Click end object Button2 : TButton Left = 432 Top = 24 Width = 17 Height = 17 Caption = 'Button2' TabOrder = 1 OnClick = Button2Click end object Button3: TButton Left = 448 Top = 40 Width = 17 Height = 17 Caption = 'Button2' TabOrder = 2 OnClick = Button3Click end Object Button4: TButton Left = 464 TOP = 56 width = 17 Height = 17 caption = 'Button2' Taborder = 3 OnClick = Button4Click Endend

A variety of different events Name:

TForm1 = class (TForm) Button1: TButton; Button2: TButton; Button3: TButton; Button4: TButton; procedure Button1Click (Sender: TObject); procedure Button2Click (Sender: TObject); procedure Button3Click (Sender: TObject); procedure Button4Click (Sender : TOBJECT); Private Procedure Wmmove (var message: twmnchittest); message wm_nchittest; {private declarations}}} end;

Var Form1: TFORM1;

IMPLEMENTATION

{$ R * .dfm}

procedure TForm1.WMmove (var Message: TWMNCHITTEST); begin Message.Result: = HTCAPTION; end; procedure TForm1.Button1Click (Sender: TObject); varR1, R2, R3, R4, R5: HRGN; begin R1: = CreateEllipticRgn (0 , 0, Round (ClientWidth / 2), ClientHeight); R2: = CreateEllipticRgn (Round (ClientWidth / 2), 0, ClientWidth, ClientHeight); R3: = CreateEllipticRgn (Round (ClientWidth / 4), Round (ClientHeight / 4 * 3), ROUND (ClientWidth / 4 * 3), ClientHeight); R4: = CreateRectrGN (0,0,0,0); R5: = CreateRectrGN (0,0,0,0); Combinergn (R4, R2, R1 , RGN_OR); Combinergn (R5, R4, R3, RGN_OR);

SetwindowRgn (Handle, R5, True); DeleteObject (R1); DeleteObject (R2); DeleteObject (R3); DeleteObject (R4); deleteObject (R5);

Procedure TForm1.Button2Click (Sender: Tobject); Begin SendMessage (Handle, WM_SYSCOMMAND, SC_MINIMIZE, 0); END;

Procedure TFORM1.BUTTON3CLICK (Sender: Tobject); Begin SendMessage (Handle, WM_SYSCOMMAND, SC_DEFAULT, 0); END;

Procedure TFORM1.BUTTON4CLICK (Sender: TOBJECT); Begin Application.Terminate; End;

End.

转载请注明原文地址:https://www.9cbs.com/read-2988.html

New Post(0)