Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

transperent Lable


Im working in Delphi8 and im using windows forms:
And I have this problem (which probably has a simple solution but I cant find it
1. im creating a PictureBox and i put a picture in it
2. i create a Label and i put it on the picture
3. i want the Label to be transparent (to get the colour of the background - image) = so it looks like i wrote on the picture but i can't (the label ‘think’ that its parent is the form and not the Image and because of that even if I change the background to be transparent – I get grey – the colour of the form)
Can someone help me please?
thanks

bh
Tuesday, June 15, 2004

I think your best bet is to check the Borland news groups.

http://support.borland.com/newsgroups/delphi.asp
news://newsgroups.borland.com/borland.public.delphi.winforms.controls.using

Steve-O
Wednesday, June 16, 2004

Solution found:
You have to add these lines AFTER the form already created the Components and attached them to itself:

Label.Parent := Picture;
Label.BackColor := Color.Transparent;
Label.Left := Label.Left - Picture.Left; //the size is relative to the
                                                          //parent control, so if we won’t change
                                                          //the Label’s location 
                                                          //it will appear in a strange place
Label.Top := Label.Top  - Picture.Top;

bh
Monday, June 28, 2004

*  Recent Topics

*  Fog Creek Home