国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 編程 > Delphi > 正文

在Delphi中實(shí)現(xiàn)任意形狀的窗體

2019-11-18 18:59:21
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

Form的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
  end
end

各種不同的事件聲名:


  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 }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.WMmove(var Message: TWMNCHITTEST);
begin
  Message.Result :=  HTCAPTION;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
R1,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);
end;

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.


上一篇:Delphi中布爾類型辨析

下一篇:Delphi嵌入式匯編一例

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
學(xué)習(xí)交流
熱門圖片

新聞熱點(diǎn)

疑難解答

圖片精選

網(wǎng)友關(guān)注

主站蜘蛛池模板: 锡林郭勒盟| 天祝| 罗江县| 太湖县| 胶州市| 松原市| 噶尔县| 石楼县| 通海县| 昌平区| 浦东新区| 南部县| 凌云县| 大丰市| 泗洪县| 凌海市| 泉州市| 卢龙县| 阿拉善左旗| 大荔县| 宜兴市| 平顺县| 将乐县| 新宾| 牡丹江市| 加查县| 阿勒泰市| 万盛区| 奇台县| 台前县| 辽宁省| 墨脱县| 祁连县| 鄢陵县| 容城县| 滨州市| 南澳县| 平邑县| 资中县| 马山县| 松溪县|