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

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(ControlStyles.SupportsTransparentBackC olor, True)
Me.UpdateStyles()
Me.BackColor = Color.Transparent
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 1484
Juan,

* "Juan Romero" <ju*********@bowne.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(ControlStyles.SupportsTransparentBackC olor, True)
Me.UpdateStyles()
Me.BackColor = Color.Transparent
Invalidate()


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

<URL:http://www.google.de/groups?selm=1kKZXIwhBHA.2504%40cpmsftngxa07>

--
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_**********@optonline.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_**********@optonline.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.GraphicsPath()
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
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...
2
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...
1
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 ...
2
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...
11
by: Noozer | last post by:
Does anyone know if we will be able to put transparent backgrounds on UserControls in VB 2004?
4
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...
2
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...
6
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...
4
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.