By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,888 Members | 1,432 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,888 IT Pros & Developers. It's quick & easy.

Shaped Forms Question

P: n/a
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.Heigh t));

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.

Nov 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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

"Flix" <wr***@newsgroup.comeon> wrote in message
news:cl**********@lacerta.tiscalinet.it...
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.Heigh t));

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.

Nov 16 '05 #2

P: n/a

"Chris Jobson" <ch**********@btinternet.com> ha scritto nel messaggio
news:%2***************@TK2MSFTNGP15.phx.gbl...
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.
Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.