请问如何用创建不规则的窗体呢? 椭圆的也行,急,谢谢

解决方案 »

  1.   

    http://www.delphibbs.com/delphibbs/dispq.asp?lid=1607958看看大富翁里面的这个帖子
      

  2.   

    这里有创建椭圆窗体的一段代码procedure TFrmMain.FormCreate(Sender: TObject);varrgn:HRGN;beginrgn:=CreateEllipticRgn(0,0,150,150);SetWindowRgn(self.Handle, rgn, true);end;
      

  3.   

    ---- Example - Making a form in the shape of a baloon -----{ Put the following code in the event handler of a button
      in a form. Put the button in the center of the form.
      When the button is clicked, the form will change shape.
      See the Win32.Hlp and look into the Region Reference
      to be able to create any Region for the window }
    procedure TForm1.Button1Click(Sender: TObject);
    var
      Reg1: HRGN;
      Reg2: HRGN;
      Reg:  HRGN;
      Apoint: Array[0..2] of TPoint;
    begin
      APoint[0] := Point(40,ClientHeight-30);
      APoint[1] := Point(30,ClientHeight);
      APoint[2] := Point(20,ClientHeight-20);
      Reg1 := CreatePolygonRgn(Apoint, 3, WINDING);
      Reg2 := CreateRoundRectRgn ( Width-ClientWidth,
                                   Height-ClientHeight,
                                   ClientWidth,
                                   ClientHeight - 10, 55, 55);
      Reg := CreateRectRgn(150,50,200,100);
      CombineRgn(Reg, Reg1, Reg2, RGN_OR);
      SetWindowRgn (handle, Reg, true);
      DeleteObject(Reg1);
      DeleteObject(Reg2);
      { Do not delete Reg object cause it is now owned by the OS }
    end;