Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

style property of TWndClass

Posted on 2002-05-02
5
Medium Priority
?
395 Views
Last Modified: 2008-03-17
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
Comment
Question by:jccommandeur
  • 2
  • 2
5 Comments
 
LVL 14

Expert Comment

by:DragonSlayer
ID: 6987783
SetWindowLong(Handle, GWL_STYLE, CS_HREDRAW or CS_VREDRAW or CS_OWNDC);
0
 
LVL 14

Expert Comment

by:DragonSlayer
ID: 6987784
put it after OnCreate... or perhaps in OnShow? forgot which one, hehehe :)
0
 
LVL 8

Accepted Solution

by:
TOndrej earned 400 total points
ID: 6988496
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
 

Author Comment

by:jccommandeur
ID: 6989536
Thanks, that was indeed what I was looking for. Do I need to register the class also?

Jeroen
0
 
LVL 8

Expert Comment

by:TOndrej
ID: 6989639
You don't have to register the class, VCL does it for you.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Loops Section Overview

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question