473,624 Members | 2,238 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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,t his.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.Ena bleVisualStyles (), 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 1898
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***@newsgrou p.comeon> wrote in message
news:cl******** **@lacerta.tisc alinet.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,t his.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.Ena bleVisualStyles (), 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**********@b tinternet.com> ha scritto nel messaggio
news:%2******** *******@TK2MSFT NGP15.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
4348
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 square, line, or rectangle should all be considered as part of the same inline block? What i want it for is I'm using a two column table to display a series of images with text, and I want the images opposite the centre of each text section, with...
0
2338
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. Here is an example of the kind of data I am trying to graph: Question: How much TV people watch a day? Responses (as a percentage of total responses): > 2.0 hours = 60% 2 - 4 hours = 30% < 4 hours = 10%
5
2548
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 background image of my form to be this image (actually a transparent png version), then I set the transparency key to red as well. Instead of the shaped form I thought I would have, I now have the graphic with a white border as my form. Is...
3
3311
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 for me. Does anyone know how I can set my irregular shaped picture as my form? Thanks for the help.
4
2466
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: //-- Code ------------------------------------------- this.FormBorderStyle = FormBorderStyle.None; this.MaximizeBox = false;
4
2431
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
2777
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 sparkles comming out of the button. When I click this button I need it to shake and have the face scream (no sound required)... This button will be located over a composite background so I would like to have transparent areas where my button is not...
0
1672
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. This works fine for irregular shaped forms becuase they have a transparency key field, but user controls dont have this field. note i do not want to see the desktop. I want to see any other controls or form behind the irregularly shaped user...
3
2286
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 enhance its appearance..
0
8170
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8675
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8619
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8334
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8474
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6108
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4078
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4173
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1784
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.