|
-
Apr 12th, 2011, 11:23 PM
#1
[RESOLVED] Transparent labelbox above Picturebox
Hi guys 
I'm playing with some new UI for one of my projects. I have created a digital display board in Photoshop and added a Picturebox in my VB project and used that image in it.
But what I want to do is, I'll be displaying some text above that image. When I tried placing a LabelBox and setting it's BackColor to Transparent, doesn't work !
The text in the LabelBox will be changing each second. So, what I'm doing is using a Timer control with 1000 as interval and displaying the text.
What will be the solution ? Do I have to draw the text on the picturebox on Paint event ?
Thanks
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Apr 12th, 2011, 11:31 PM
#2
Re: Transparent labelbox above Picturebox
A control with a transparent background will display its parent. If the Label's parent is the form, you'll see the form through the Label. You need to make the PictureBox the Label's parent, which you can't do in the designer. Position the Label where you want it and then use code like this:
vb.net Code:
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load Me.Label1.Location = Me.PictureBox1.PointToClient(Me.PointToScreen(Me.Label1.Location)) Me.Label1.Parent = Me.PictureBox1 End Sub
That assumes that the Label's original parent is the form. If not, call PointToScreen on the Label's original parent control.
-
Apr 12th, 2011, 11:39 PM
#3
Re: Transparent labelbox above Picturebox
Thanks jm 
It was inside a SplitPanel and I used this code:
vb.net Code:
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Me.Label1.Location = Me.PictureBox1.PointToClient(SplitPanel4.PointToScreen(Me.Label1.Location))
Me.Label1.Parent = Me.PictureBox1
End Sub
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Apr 12th, 2011, 11:47 PM
#4
Re: [RESOLVED] Transparent labelbox above Picturebox
It occurred to me that you could always just do this:
vb.net Code:
Me.Label1.Location = Me.PictureBox1.PointToClient(Me.Label1.Parent.PointToScreen(Me.Label1.Location))
-
Apr 12th, 2011, 11:53 PM
#5
Re: [RESOLVED] Transparent labelbox above Picturebox
Thanks 
That's also working 
vb.net Code:
Me.lblElapsed.Location = Me.PictureBox1.PointToClient(Me.lblElapsed.Parent.PointToScreen(Me.lblElapsed.Location))
Me.lblElapsed.Parent = Me.PictureBox1
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Apr 12th, 2011, 11:58 PM
#6
Re: Transparent labelbox above Picturebox
[edit: a whole correspondence took place while I was working out my reply. Never mind ]
Last edited by boops boops; Apr 13th, 2011 at 12:03 AM.
-
Apr 13th, 2011, 12:05 AM
#7
Re: Transparent labelbox above Picturebox
 Originally Posted by boops boops
[edit: a whole correspondence took place while I was working out my reply. Never mind  ]
You were slow 
Thanks for trying out to find a solution.
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Sep 8th, 2011, 08:09 PM
#8
Re: [RESOLVED] Transparent labelbox above Picturebox
It occurred to me further that you could also do this:
vb.net Code:
Me.Label1.Location = Me.PictureBox1.PointToClient(Me.Label1.PointToScreen(Point.Empty))
-
Sep 8th, 2011, 11:34 PM
#9
Re: [RESOLVED] Transparent labelbox above Picturebox
Thanks
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|