• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 400
  • Last Modified:

style property of TWndClass

Hi there,

I use regular mdi child forms in my program. I create these forms by using Application.Createform. Now I want to set the style property of the TWndClass for these mdi child forms like this:

style := CS_HREDRAW or CS_VREDRAW or CS_OWNDC;

But as far as I know, we only use TWndClass in Win32 applications. How do I set this style property in VCL application???

Bye,
Jeroen
0
jccommandeur
Asked:
jccommandeur
  • 2
  • 2
1 Solution
 
DragonSlayerCommented:
SetWindowLong(Handle, GWL_STYLE, CS_HREDRAW or CS_VREDRAW or CS_OWNDC);
0
 
DragonSlayerCommented:
put it after OnCreate... or perhaps in OnShow? forgot which one, hehehe :)
0
 
TOndrejCommented:
You can simply override CreateParams in your MDI child forms:

type
  TMyMDIChildForm = class(TForm)
  ...
  protected
    procedure CreateParams(var Params: TCreateParams); override;
  end;

procedure TMyMDIChildForm.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(Params);
  with Params do
    WindowClass.style := CS_HREDRAW or CS_VREDRAW or CS_OWNDC;
end;

HTH
TOndrej
0
 
jccommandeurAuthor Commented:
Thanks, that was indeed what I was looking for. Do I need to register the class also?

Jeroen
0
 
TOndrejCommented:
You don't have to register the class, VCL does it for you.
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now