Custom shaped forms?

A few months back I responded to a similar question, the response in the form of an example is listed below. The code listed below makes a captionless borderless round form.

 

  1. Start a new application.

  2. Override the forms createparams method as shown.

  3. Place your bitmap on the form, and set the transparent property to true.

  4. Place a speed button on the form and write a method to close the application. (Making a round form will result in the little icons in the corner not being visible.

  5. Assign the method shown below to the form's oncreate event.

Hope this helps.


unit Unit1;

interface

uses

  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

  ExtCtrls, Buttons;

type

  TForm1 = class(TForm)

  Image1: TImage;

  SpeedButton1: TSpeedButton;

  procedure FormCreate(Sender: TObject);

  procedure SpeedButton1Click(Sender: TObject);

  private

  { Private declarations }

  procedure CreateParams(var Params: TCreateParams); override;

  public

  { Public declarations }

  end;

var

  Form1: TForm1;

implementation

procedure TForm1.CreateParams(var Params: TCreateParams);

begin

inherited createparams(params);

{This makes a borderless and captionless form}

params.style:=params.style or ws_popup xor ws_dlgframe;

end;

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);

var

formrgn:hrgn;

begin

{makes the form clear}

form1.brush.style:=bsclear;

{makes the form round}

GetWindowRgn(form1.Handle, formRgn);

  DeleteObject(formRgn);

  formrgn:=

  CreateroundRectRgn(0,

0,form1.width,form1.width,form1.width,form1.width);

  SetWindowRgn(form1.Handle, formrgn, TRUE);

end;

procedure TForm1.SpeedButton1Click(Sender: TObject);

begin

form1.close;

end;

end.