473,386 Members | 1,795 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,386 software developers and data experts.

Shaped Forms

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;
this.BackColor = Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)),
((System.Byte)(255)));
this.TransparencyKey = Color.FromArgb(((System.Byte)(128)),
((System.Byte)(128)), ((System.Byte)(255)));

//-- End of Code ------------------------------------

I am then drawing graphics of a clock as per
http://www.publicjoe.f9.co.uk/csharp...nalogclock.exe
application.

This works great under windows 2000, but not XP. Can someone please point me
in the right direction.

Full code can be seen at
http://www.publicjoe.f9.co.uk/csharp...analogclock.cs

Thanks in advance

Publicjoe

Nov 16 '05 #1
4 2451
What doesn't work? My shaped form with a transparency key works a treat
under XP...

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Publicjoe" <mi**@publicjoe.co.uk> wrote in message
news:ee**************@TK2MSFTNGP15.phx.gbl...
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;
this.BackColor = Color.FromArgb(((System.Byte)(128)),
((System.Byte)(128)),
((System.Byte)(255)));
this.TransparencyKey = Color.FromArgb(((System.Byte)(128)),
((System.Byte)(128)), ((System.Byte)(255)));

//-- End of Code ------------------------------------

I am then drawing graphics of a clock as per
http://www.publicjoe.f9.co.uk/csharp...nalogclock.exe
application.

This works great under windows 2000, but not XP. Can someone please point
me
in the right direction.

Full code can be seen at
http://www.publicjoe.f9.co.uk/csharp...analogclock.cs

Thanks in advance

Publicjoe

Nov 16 '05 #2
Hi Bob,

In the linked file, I use GDI+ to draw on the form.
http://www.publicjoe.f9.co.uk/csharp...analogclock.cs

On my other PC running XP, I get a light blue background around the clock
from the above code. On windows 2000, I see the background of the destop or
other application that is there instead. Weird!

If you could compile the code above into an app and let me know what you see
on XP, I would be grateful.

I will have a look at your code that you attached to the other email later
to see how you use a bitmap to do shaped forms.

Cheers

Publicjoe

"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:O0**************@TK2MSFTNGP12.phx.gbl...
What doesn't work? My shaped form with a transparency key works a treat
under XP...

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Publicjoe" <mi**@publicjoe.co.uk> wrote in message
news:ee**************@TK2MSFTNGP15.phx.gbl...
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;
this.BackColor = Color.FromArgb(((System.Byte)(128)),
((System.Byte)(128)),
((System.Byte)(255)));
this.TransparencyKey = Color.FromArgb(((System.Byte)(128)),
((System.Byte)(128)), ((System.Byte)(255)));

//-- End of Code ------------------------------------

I am then drawing graphics of a clock as per
http://www.publicjoe.f9.co.uk/csharp...nalogclock.exe
application.

This works great under windows 2000, but not XP. Can someone please point me
in the right direction.

Full code can be seen at
http://www.publicjoe.f9.co.uk/csharp...analogclock.cs

Thanks in advance

Publicjoe


Nov 16 '05 #3
Publicjoe,

Both computers have a max of 24bits colorquality?

Cor
Nov 16 '05 #4
I will check the machine at home. The Windows 2000 machine is running 16bit
colour. It may be that I am running 32 bit on XP.

Thanks

Publicjoe

"Cor Ligthert" <no************@planet.nl> wrote in message
news:Ot**************@TK2MSFTNGP15.phx.gbl...
Publicjoe,

Both computers have a max of 24bits colorquality?

Cor

Nov 16 '05 #5

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...
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...
2
by: Flix | last post by:
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...
2
by: Publicjoe | last post by:
I now understand the issue. The code Bob posted has the same issue. It appears that when you have the screen resolution set to 32-bit, then the transparencykey does not work. Thanks guys for...
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: 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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...

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.