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

Home Posts Topics Members FAQ

Transparent form, opaque label

I have Visual Basic .NET 2003, and wanted to create a form that only shows
the contents of a label.
The form can't have a title bar or border. It seriously needs to just be
the text inside the label.

Can this be done?

Matthew
Nov 21 '05 #1
5 6102
> I have Visual Basic .NET 2003, and wanted to create a form that only shows
the contents of a label.


Me.FormBorderSt yle = FormBorderStyle .None
Me.ControlBox = False
Me.Transparency Key = Me.BackColor

I found the above code, and it makes everything go away except the
background for my label. I have tried setting the background color of the
label to transparent, but it is still an ugly grey color.

Matthew
Nov 21 '05 #2
> I have Visual Basic .NET 2003, and wanted to create a form that only shows
the contents of a label.


Me.FormBorderSt yle = FormBorderStyle .None
Me.ControlBox = False
Me.Transparency Key = Me.BackColor

I found the above code, and it makes everything go away except the
background for my label. I have tried setting the background color of the
label to transparent, but it is still an ugly grey color.

Matthew
Nov 21 '05 #3
23s
How about this:

Set the form border style to None

Set the background color of the form to some color you aren't likely to use,
like 'Magenta' (bright pink).

Set the transparency key of the form to Magenta (or whatever color you chose
above)

Put a label on the form. Set the label's background color to 'Transparent'.
Populate the label with some text, run the app / show the form and you
should only see the label text. Note this was tested in WinXP SP2, dunno if
other/older OS's have transparency issues with forms.

"Matthew" <tu************ *@alltel.net> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
I have Visual Basic .NET 2003, and wanted to create a form that only shows
the contents of a label.
The form can't have a title bar or border. It seriously needs to just be
the text inside the label.

Can this be done?

Matthew

Nov 21 '05 #4
> Set the form border style to None

Set the background color of the form to some color you aren't likely to
use, like 'Magenta' (bright pink).

Set the transparency key of the form to Magenta (or whatever color you
chose above)

Put a label on the form. Set the label's background color to
'Transparent'. Populate the label with some text, run the app / show the
form and you should only see the label text. Note this was tested in
WinXP SP2, dunno if other/older OS's have transparency issues with forms.


Thanks for the response. I also have XP SP2. What a happy coincidence!

I folowed your steps, but the background of the label was Magenta. Was
there another setting you might have modified?
Or, if you have a working example, could you send it to me?

Thanks,

Matthew
Nov 21 '05 #5
> I have Visual Basic .NET 2003, and wanted to create a form that only shows
the contents of a label.
The form can't have a title bar or border. It seriously needs to just be
the text inside the label.


I think I figured it out.

Me.FormBorderSt yle = FormBorderStyle .None
Dim Img As Bitmap = New Bitmap(10, 10)
Img.MakeTranspa rent(Img.GetPix el(1, 1))
Me.BackgroundIm age = Img
Me.Transparency Key = Img.GetPixel(1, 1)

For some reason, having the background as an image seems to be more
effective than making the TransparencyKey the BackColor:
Me.Transparency Key = Me.BackColor

Matthew
Nov 21 '05 #6

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

Similar topics

5
9492
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 ...)
4
4699
by: DS | last post by:
Anyone know of any downsides of using Transparent Buttons with Labels behind them? Thanks DS
4
2550
by: jcrouse | last post by:
I am using the following code to move a label on a form at runtime: If myMousedown = lblP1JoyRight.Name Then If lblP1JoyRight.BackColor.Equals(Color.Transparent) Then bTransCk = True lblP1JoyRight.BackColor = clrLabelMove
1
2909
by: Per Larsson | last post by:
Hi all! I am working with a project and want to make a form that is semi transparent, and transparent to mouse clicks. (Se through and click through.) The form shall be visible but opaque and the mouse clicks shall go through to the under lying window. I can make it transparent by setting the Opaqe property, and by setting the TransparencyKey colour I can make it click through in parts that then becomes invisible. But I want the hole...
2
7580
by: Dean Slindee | last post by:
It appears that I have two routines that don't play well together! First routine: a form's background is shaded with a gradient color. Second routine: then, the background of all labels on the form are made transparent. What results is the label's backcolor appearing as blocks of 'control' colored background. Setting the label's backcolor to color.transparent does not make it transparent (evidently the text is repainted with a...
4
9347
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...
3
3960
by: vul | last post by:
I used to use creating headers (label at the top of the screen) for VB6 forms as 2 labels shifted a little bit with different for colors to get a simulation of a shadow. I set BackColor of both labels to Transparent. Everything works fine. I'm trying to use the same approach with VB 2005 windows forms. Although I'm setting labels backcolors to transparent, it is not transparent and the label located behind is not visible. I tried to...
4
4804
by: google | last post by:
My app uses a tab control created in Access 97 and converted to Access 2000 format for clients who have Access 2000, 2003 and 2007. Being created in 97, the control does not have a BackStyle=transparent property. When opened in 2003, the backstyle is Normal (opaque). When opened in 2007, the backstyle is still Normal, but the control is transparent. If I open the form in design view in A2007, the backstyle property is Normal, but the...
3
1931
by: Torleif Berger | last post by:
Is it possible to have a transparent Form? And by that I mean that the background should be transparent. I have tried to set the Opaque property, but that makes everything transparent. I use OnPaint an OnBackgroundPaint to draw stuff on the form, and when I set Opaque, what I draw is transparent as well. And I would like it not to be. I have also tried
0
8240
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
8680
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
8625
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
8336
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,...
1
6111
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
5565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4082
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...
1
2610
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
2
1487
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.