473,769 Members | 2,355 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to set a label's backcolor to transparent?

The code below runs in the form_paint event but changes nothing, anyone got
a better idea or why this code is not effective?

Imports System.Drawing. Drawing2D

Dim ctl As Control

Dim str As String

For Each ctl In Me.Controls

str = ctl.GetType.ToS tring

If str = "System.Windows .Forms.Label" Then

ctl.BackColor = System.Drawing. Color.Transpare nt

End If

Next

Thanks,

Dean Slindee
Nov 21 '05 #1
1 8356
The Transparent will set the control to be transparent with respect to its
parent
So Incase of the label, it will become transparent for the Form and if the
form has a background image will show through the label.
But the lable cant be transparent for other controls.
In case you want some heirarchial transparency, then you can manoeuvr the
parent/child relationships of the controls to do this.

HTH
rawCoder

"Dean Slindee" <sl*****@charte r.net> wrote in message
news:ys******** ****@fe06.lga.. .
The code below runs in the form_paint event but changes nothing, anyone got a better idea or why this code is not effective?

Imports System.Drawing. Drawing2D

Dim ctl As Control

Dim str As String

For Each ctl In Me.Controls

str = ctl.GetType.ToS tring

If str = "System.Windows .Forms.Label" Then

ctl.BackColor = System.Drawing. Color.Transpare nt

End If

Next

Thanks,

Dean Slindee

Nov 21 '05 #2

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

Similar topics

4
6624
by: Efkas | last post by:
Hi, I had some label with BackColor.Transparent and a User Control also with transparent background. When I put a label on the user control, instead to have transparent result I obtain a background containing a kind of stack or buffer of all controls in my form that are defined with transparent background. I don't understand this! *-----------------------* Posted at:
0
842
by: Peter Oliphant | last post by:
I'm trying to make my Label's transparent. According to the documentation, setting the Label's BackColor property to Color::Transparent should do this. However, all it seems to do is change the BackColor to the BackColor of the Form its on. Needless to say, this is not the same as transparency, especially when the Label overlaps with some other visible element or if your Form has an image as a background! Is there a way to make a Label...
9
14820
by: SStory | last post by:
I have a picturebox in my About form. would like to have a link to my company website. Wanted the links background to be transparent. It seems that no one knows how to do this. Have asked many times. VB help says that transparent is possible with a background image but not above a control. So how can I provide a link (URL) that is clickable, but transparent, over the picturebox in my about box?
2
2066
by: UJ | last post by:
I have a browser object on a form with a label in front of it. I want the label to be transparent so that you can see what's going on in the browser behind it. When I make the label transparent (backcolor = color.transparent) what it shows is the window, not the control behind it. What am I doing wrong? TIA - Jeff
3
6508
by: melanieab | last post by:
Hi, I'd like to put a transparent label over a textbox. I set the label backcolor to transparent, and set its parent as the textbox. But setting the textbox as the parent resulted in the label not showing up at all (I changed the backcolor to a color to see if it would show up). Anyone know what to do? Thanks!!! Mel
2
10987
by: Martin | last post by:
I've been complaing about the VB2005 Help-Information (or rather the lack of it) before, but when I was looking how to set the backstyle of a label control to "Transparent" I found that the VB2005 documentation has reached an all-time low (please note the part about the z-order): MSDN: In Visual Basic 6.0, the BackStyle property of the Label control determines whether the label had a transparent background. Setting the BackStyle...
4
9372
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 and erase text to the RichTextbox. i'm assuming that it is the backcolor that hides what is...
0
1806
by: VorTechS | last post by:
I'm having a problem with an inherited label, applying text rotation to aligned text. If text rotation is applied to the aligned text, the alignment goes 'nuts'. I can find no logic to what is happening. I've built the following code from several examples on the web, if you remove the rotation then alignment works fine: Imports System.ComponentModel
5
1164
by: Brian S. | last post by:
Hi, Is there a way to make the lable background transparent? I though I was about to do this in Access 2.0... but its been a few years... Brian
0
9589
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10222
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...
1
9999
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
9866
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...
0
8876
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5310
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
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3967
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2815
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.