473,564 Members | 2,730 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Making a control with transparent background

Hey guys,
Does anyoone know how to make a control with transparent background?

This is what I have so far and it doesn't work:

Me.SetStyle(Con trolStyles.Supp ortsTransparent BackColor, True)
Me.UpdateStyles ()
Me.BackColor = Color.Transpare nt
Invalidate()

This allows me to set the background color to transparent, but when I run
the form, the control still draws with color.

Any other ideas?

Thanks!
Nov 20 '05 #1
5 1499
Juan,

* "Juan Romero" <ju*********@bo wne.com> scripsit:
Does anyoone know how to make a control with transparent background?

This is what I have so far and it doesn't work:

Me.SetStyle(Con trolStyles.Supp ortsTransparent BackColor, True)
Me.UpdateStyles ()
Me.BackColor = Color.Transpare nt
Invalidate()


Maybe this post will help you to understand what
'SupportsTransp arentBackColor' actually does:

<URL:http://www.google.de/groups?selm=1kK ZXIwhBHA.2504%4 0cpmsftngxa07>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2
Thanks for replying Herfried,

I checked out the link you gave me, but that still does not answer my
question.

I knew this is not really the way, I actually posted the style thing
with my message so someone else wouldn't come and give me the same
answer >:)

Any other ideas?

Thanks!

Regards,
Juan Romero
(To e-mail me remove the underscores from my e-mail address.)

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #3
* Juan Romero <j_**********@o ptonline.net> scripsit:
I checked out the link you gave me, but that still does not answer my
question.

I knew this is not really the way, I actually posted the style thing
with my message so someone else wouldn't come and give me the same
answer >:)


If the shape is not too complex, create a 'GraphicsPath' of appropriate
form, convert it to a 'Region' and assign this region to the controls
(hidden) 'Region' property.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #4
I am completely new to imaging (as you can already see) which is why I
am playing with these things, hoping to learn. Can you please give me
some sample code or links I can follow to better understand this?

Thanks!

Regards,
Juan Romero
(To e-mail me remove the underscores from my e-mail address.)

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #5
* Juan Romero <j_**********@o ptonline.net> scripsit:
I am completely new to imaging (as you can already see) which is why I
am playing with these things, hoping to learn. Can you please give me
some sample code or links I can follow to better understand this?


For example, add this code to the usercontrol's 'Load' event handler:

\\\
Dim intDiameter As Integer = 300
Me.Height = intDiameter
Me.Width = intDiameter
Dim p As New Drawing2D.Graph icsPath()
p.AddEllipse(0, 0, intDiameter, intDiameter)
Me.Region = New Region(p)
p.Dispose()
Me.BackColor = Color.Red
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
9477
by: Paul Schnitter | last post by:
Update: My custom control is based on the article "Creating Visual Basic .NET controls from scratch" in "Adventures in .NET" on MSDN. It is designed to be a replacement for the VB6 shape control. My control draws a shape (circle, square, rectangle ...)
2
1810
by: Regnab | last post by:
I've got a YES/NO section of a report I'm making. Depending on certain values, I want to circle either YES or NO. I've got the code working so it'll show or hide the circle, but I can't seem to get the circle (which I drew in Adobe Photoshop because I want the handwriting look) to be transparent (ie show the Yes or the No in the middle of it)....
1
20163
by: Efkas | last post by:
My application have some level : 1. MyButton class with Label inheritance 2. MyComponent as User Control loading and positionning some of MyButtons 3. MyApp loading and positionning MyComponent I prefer don't insert a background in MyComponent, and using the MyApp one as general background with MyComponent positionned, but I am not able...
2
2350
by: FredC | last post by:
I went thru the walkthough:"Walktrough: Authoring a User Control with Visual c#". All is fine except that when I add this control to my form that has a map as a background, I can't see through the control. The control's BackColor won't accept Transparent. How do I do this so that the background map shows through?
11
1416
by: Noozer | last post by:
Does anyone know if we will be able to put transparent backgrounds on UserControls in VB 2004?
4
9344
by: ray well | last post by:
in my app i need to make a RichTextbox control transparent. i need it to be a like a pane of glass lying on a sheet of paper, where u can see everything on the sheet of paper not covered by text written on the glass pane. i need to be able to see the control or form that is underneath the RichTextbox, and at the same time to be able to write...
2
6567
by: Niu Kun | last post by:
Dear all, I'm trying to draw many overlapped PNG files with transparent background in imagebox control. But the transparent background in this control is rendered as the main control's background color. So the image formerly drawn is covered by the latter image with unwanted background color. I wonder if I can get really transparent...
6
11015
by: HristiyanVasilev | last post by:
Hello there ! I'm developing a Windows appliciation that involves so called "Transparent Controls". As you would probably know, the only ( as far as i know ) way to achieve a fully transparent control in C# is to add the so called "Transparent style" to your control ("WS_EX_TRANSPARENT"). There are numerous articles how to achieve this and the...
4
3361
by: Rishabh Indianic | last post by:
i am developing smart phone application with VS 2005 using C#. i am trying to transparent the background of link label control which dynamically added in panel. i try with following code to transparent the background of link label control . LinkLabel lnklbl = new LinkLabel(); lnklbl .Text="Click Me"; lnklbl .BackColor =...
0
7666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7584
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...
0
7888
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. ...
0
8108
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...
1
7644
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...
1
5484
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...
0
3643
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...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
925
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.