10 Replies - 15758 Views - Last Post: 03 December 2010 - 10:55 PM Rate Topic: -----

#1 chris_24  Icon User is offline

  • New D.I.C Head

Reputation: 10
  • View blog
  • Posts: 37
  • Joined: 29-November 10

label backcolor can't be transparent

Posted 02 December 2010 - 08:56 AM

what shall i do if i want to make a label's backcolor transparent or even just looking like transparent?
VB.NET doesn't support transparent label backcolor.

This post has been edited by chris_24: 02 December 2010 - 08:58 AM

Is This A Good Question/Topic? 1
  • +

Replies To: label backcolor can't be transparent

#2 elenas 6  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 02-December 10

Re: label backcolor can't be transparent

Posted 02 December 2010 - 09:08 AM

well then try making a part of whatever image behind the label the labels background but needs to position it correctly..
Was This Post Helpful? 0
  • +
  • -

#3 ljfox4  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 67
  • Joined: 10-February 07

Re: label backcolor can't be transparent

Posted 02 December 2010 - 09:18 AM

I just checked and had no problem setting a label's BackColor to Transparent. I simply clicked the control, found BackColor in the Properties Windows, and found Transparent in the drop-down box under the Web tab. Note that I'm using Visual Studio 2010, and .NET Framework 4.0. I'm not sure if that makes a difference or not.

This post has been edited by ljfox4: 02 December 2010 - 09:19 AM

Was This Post Helpful? 1
  • +
  • -

#4 chris_24  Icon User is offline

  • New D.I.C Head

Reputation: 10
  • View blog
  • Posts: 37
  • Joined: 29-November 10

Re: label backcolor can't be transparent

Posted 02 December 2010 - 09:34 AM

no i think you didn't preview it well,.
i tried to put black gradient image behind and put a label and set it's backcolor to transp. but
nothing happened after many times i got a prompt saying it doesn't support transparency on backcolor.,
Was This Post Helpful? 1
  • +
  • -

#5 Luc001  Icon User is offline

  • D.I.C Addict

Reputation: 84
  • View blog
  • Posts: 617
  • Joined: 04-May 09

Re: label backcolor can't be transparent

Posted 02 December 2010 - 11:18 AM

View Postchris_24, on 02 December 2010 - 03:56 PM, said:

what shall i do if i want to make a label's backcolor transparent or even just looking like transparent?
VB.NET doesn't support transparent label backcolor.


Hi,

When you set the backcolor of a control to transparent it will take it parents background.
So if your label is for example over a picturebox and its parent is the form the forms background will show. So add the control to the picturebox's controls collection.

This post has been edited by Luc001: 02 December 2010 - 11:19 AM

Was This Post Helpful? 2
  • +
  • -

#6 chris_24  Icon User is offline

  • New D.I.C Head

Reputation: 10
  • View blog
  • Posts: 37
  • Joined: 29-November 10

Re: label backcolor can't be transparent

Posted 02 December 2010 - 06:09 PM

works fine, thank goodness.so you say i always need to put extra picture box that can get transparent and will be no problem for any label on front?,because picture box can be transp.,
thanks for that luc001,.
Was This Post Helpful? 1
  • +
  • -

#7 chris_24  Icon User is offline

  • New D.I.C Head

Reputation: 10
  • View blog
  • Posts: 37
  • Joined: 29-November 10

Re: label backcolor can't be transparent

Posted 02 December 2010 - 06:22 PM

I also tried to put a background on the form then set the label transparent and it also worked good
quicker than adding another step which is putting a picturebox setting it's background to transparent then the label over it set to transp...
Was This Post Helpful? 1
  • +
  • -

#8 _HAWK_  Icon User is online

  • Master(Of Foo)
  • member icon

Reputation: 1043
  • View blog
  • Posts: 4,061
  • Joined: 02-July 08

Re: label backcolor can't be transparent

Posted 03 December 2010 - 04:06 AM

You could just draw the text you want on what ever control you want.

Make a class level variable to store the string then in the paint event:

e.Graphics.DrawString(<text>, <font>, <brush>, <x loc>, <y loc>)

DrawString
Was This Post Helpful? 2
  • +
  • -

#9 chris_24  Icon User is offline

  • New D.I.C Head

Reputation: 10
  • View blog
  • Posts: 37
  • Joined: 29-November 10

Re: label backcolor can't be transparent

Posted 03 December 2010 - 06:08 AM

how if the parent of the label is a picturebox?
i tried it's not working and it only accepts the form as it's only parent.,
so if i overlay a label behind a picturebox it doesn't show transparency as if
i'm overlaying a net above a fish picture.,it should look like the fish is inside the net.,
how?
Was This Post Helpful? 1
  • +
  • -

#10 _HAWK_  Icon User is online

  • Master(Of Foo)
  • member icon

Reputation: 1043
  • View blog
  • Posts: 4,061
  • Joined: 02-July 08

Re: label backcolor can't be transparent

Posted 03 December 2010 - 12:44 PM

You may consider using GDI+ and layering the graphics. When you are drawing the first thing in is the bottom-most layer and you build on that. You can use a base image as the BackgroundImage then draw other images on top of that and of course your text as well. Gif's work great for images that have transparent parts/pixels.
Was This Post Helpful? 0
  • +
  • -

#11 chris_24  Icon User is offline

  • New D.I.C Head

Reputation: 10
  • View blog
  • Posts: 37
  • Joined: 29-November 10

Re: label backcolor can't be transparent

Posted 03 December 2010 - 10:55 PM

because it's complicated when there's a background and some pictureboxes overlaying one another at a given time besides, it's a simple game im trying to start with..


GIF is one good idea.., :turned:

This post has been edited by chris_24: 03 December 2010 - 10:55 PM

Was This Post Helpful? 1
  • +
  • -

Page 1 of 1