ianski Posted May 26, 2004 Posted May 26, 2004 Hello all, I'm stuck on a problem with VB .net 2003. In VB6 I used to be able to set the background colour of labels to be transparent, but now in .net it seems you can't do it properly. The help doc for the .net framework says you can set the transparency of a label okay, but "This will allow the background image to show through, but it will not be transparent in regard to other controls." And that's what I'm trying to do! I need to be able to put a label over the top of a bitmap/jpeg picture and have the backcolor of the label be completely transparent so you can see the image. Anyone have any ideas what I can do? Thanks, Ian. Quote
*Experts* DiverDan Posted May 26, 2004 *Experts* Posted May 26, 2004 Either paint the label text directly onto the bitmap or load the bitmap into a panel then add the label, with its back color set to transparent, to the panel. Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
ianski Posted May 29, 2004 Author Posted May 29, 2004 If you paint the text direction onto the bitmap, can you then move the text around later? I'm currently letting the user drag the text around to a different location by using a mousedown event and changing the co-ordinates of the label. With the panel idea, the text may be going off of the bitmap (and perhaps overlapping onto a different one) so I think this one might be a bit difficult to pull off. Thanks for your help! Either paint the label text directly onto the bitmap or load the bitmap into a panel then add the label' date=' with its back color set to transparent, to the panel.[/quote'] Quote
*Experts* DiverDan Posted May 30, 2004 *Experts* Posted May 30, 2004 It is possible to calculate and paint the text as you move the cursor...but the amount of calculations in very little time, along with invalidating the panel with every movement will probably cause an overflow and crash the program. Why don't you paint the text on the jpg when its placed, then create a label with a tinted alpha backcolor for moving the text around simular to Windows Explorer? I think it'll look really nice and will be fairly easy to accomplish. Dan Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
ianski Posted May 30, 2004 Author Posted May 30, 2004 Your idea sounds pretty cool, but I don't think it's what I'm looking for. I need to be able to draw a jpg anywhere, any size, with the ability for you to move it around. I also need to be able to write text anywhere on the screen, any size, with the ability to move it around independently to any other text or jpgs. So far what seems to be the most feasible idea is to DrawString some text on the screen, then clear it and draw it again in a new location when it gets moved... I was hoping to get a simple way to make labels truly transparent though :P It is possible to calculate and paint the text as you move the cursor...but the amount of calculations in very little time, along with invalidating the panel with every movement will probably cause an overflow and crash the program. Why don't you paint the text on the jpg when its placed, then create a label with a tinted alpha backcolor for moving the text around simular to Windows Explorer? I think it'll look really nice and will be fairly easy to accomplish. Dan Quote
AlexCode Posted June 7, 2004 Posted June 7, 2004 You could grab the image underneeth the label and set it as the label backgroud image. I don't know how performant this would be as I never tryed it but it would really look transparent... And since you need to drag the label around... This article could help you hot on this: http://codeproject.com/csharp/ImageCapture.asp Alex :p Quote Software bugs are impossible to detect by anybody except the end user.
Hamburger1984 Posted June 7, 2004 Posted June 7, 2004 see attached project - should point you to the right direction... Hope this helps! AndreasDragText.zip Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.