Shaped Forms Question

  • Thread starter Thread starter Flix
  • Start date Start date
F

Flix

I need some help to handle the Region property of my Form in the correct
way.
Usually when I create shaped forms in my programs, I modify the Form.Region
property, making it include only a part of the form client rectangle (I use
a custom button to close my form).
The problem is that when I want to go back to a normal shaped form at
runtime, I use the following line of code:

this.Region=new System.Drawing.Region(new
System.Drawing.Rectangle(0,0,this.Width,this.Height));

This line works, but creates an old fashioned flat titlebar, not a XP style
titlebar.
This effect is very easily observable: just put the line above at the end of
a Form constructor and run the program.
I tried with Application.EnableVisualStyles(), but it doesn't seem to work.
The Form class doesn't have a FlatStyle property to be set to System.
Any help is welcome. Thank you in advance.
 
If you just want to restore the form to its "default" state then you don't
need a region at all, so
this.Region = null;
should work.

Chris Jobson
 
Chris Jobson said:
If you just want to restore the form to its "default" state then you don't
need a region at all, so
this.Region = null;
should work.

Thank you. I will try it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top