Mirror

How to give a MDI application a 3D frame (Views: 100)


Problem/Question/Abstract:

How to give a MDI application a 3D frame

Answer:

You can give an MDI application a 3D frame in Delphi by overriding the main form's CreateWnd method:

procedure TMainForm.CreateWnd;
begin
  inherited CreateWnd;
  SetWindowLong(ClientHandle, GWL_EXSTYLE, GetWindowLong(ClientHandle, GWL_EXSTYLE)
    or WS_EX_CLIENTEDGE);
end;

In the interface section of your main form's unit you have a type definition for the main form that
looks something like:

type
  TMainForm = class(TForm)
    { maybe some field are defined here }
  private
    { private declarations }
  public
    { public declarations }
  end;

Add the following two lines immediately preceding the end:

protected

procedure CreateWnd; override;

Now add that procedure that I gave you in the implementation section of the unit:

procedure TMainForm.CreateWnd;
begin
  inherited CreateWnd;
  SetWindowLong(ClientHandle, GWL_EXSTYLE, GetWindowLong(ClientHandle, GWL_EXSTYLE)
    or WS_EX_CLIENTEDGE);
end;

<< Back to main page