473,387 Members | 3,781 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Shaped Forms Question

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
2 1889
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

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: skullcap | last post by:
Is there any way using HTML 4.01 of wrapping text and other inline elements into an 'L' or 'C' shaped space in a table - i.e. telling the browser that a series of table cells which don't form a...
0
by: Angela | last post by:
I am using VS.NET 2003 and Crystal 9. I have been told by Crystal, as well as many co-workers who know Crystal really well, that I cannot create the particulat graph I need using Crystal Reports....
5
by: vBOT | last post by:
Hi all, I have an odd shaped graphic I would like to use as my interface (see it here at http://www.mokee.com/vbot/ver3/face.jpg) The part I want to be transparent on the image is red. I set the...
3
by: James | last post by:
I have an picture cut out in a certain shape that I would like to make as my form. I have tried following the directions in MSDN on how to make shaped windows forms but their directions did not work...
4
by: Publicjoe | last post by:
Hi guys, I am writing an app that I wish to have a transparent background and hence a shaped form. In the InitializeComponent() method I set the members of the form to the following: //--...
4
by: Failure | last post by:
As far as I know, Groupboxes only come in one shape, a rectangle. But on one of my forms, it would be best if I could have a groupbox that's shaped like this: _______ | | _________|...
3
by: Arturo Toledo | last post by:
Ok.. I need to create a button. Not a normal one. I need one that has a STAR shape. I need it to be yellow and with a face. When I rollover this button I need the face to smile and to have...
0
by: dr | last post by:
C# Irregular shaped user controls. How to make usercontrol have transparency key for its background image? I want to have irregular shaped user controls on my form. like a funny shaped button....
3
vdraceil
by: vdraceil | last post by:
Hi everyone,i just wanted to know whether it is possible to hav different shaped command buttons in VB6.0?-i mean using oval shaped buttons,star shaped buttons,something like that in my forms just to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.