Good.
You are offsetting the original position by 1 px.
'--------------------------------------------------------------
Public Class Form1
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
'Format your label
Me.LabelTitle.T ext = "TITLE OF MY FORM"
Me.LabelTitle.F oreColor = Color.DarkBlue
Me.LabelTitle.F ont = New Font(FontFamily .GenericSansSer if, 40)
'Give your label a shadow
MakeShadowToLab el(Me.LabelTitl e, Color.DarkGray, 5)
End Sub
Sub MakeShadowToLab el(ByRef Label As Label, ByVal ColorUmbra As
Color, ByVal Offset As Integer)
Dim LabelForShadow As New Label
With LabelForShadow
.Location = Label.Location
.Location.Offse t(Offset, Offset)
.Text = Label.Text
.Font = Label.Font
.Size = Label.Size
.TextAlign = Label.TextAlign
'add possible properties to maintain
.BackColor = Color.Transpare nt
.ForeColor = ColorUmbra
.Parent = Label.Parent
End With
With Label
.Location = New Point(-Offset, -Offset)
.Parent = LabelForShadow
End With
End Sub
End Class
-tom
http://cam70.sta.uniroma1.it/community/
vul ha scritto:
I found a pretty easy way to do that:
I place 2 labels on the form and added this code:
Label3.BackColo r = Color.Transpare nt
Label3.Location = New Point(0, 300)
Label3.ForeColo r = Color.Black
Label4.Parent = Label3
Label4.Location = New Point(-1, -1)
Label4.ForeColo r = Color.Gray
Everything looks very similar to what I have in VB6
Al
"vul" <aa*@optonline. netwrote in message
news:Oz******** ******@TK2MSFTN GP06.phx.gbl...
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 create a simple sample with labels in VB6 and convert to VB
2005. VB6 version works as I want, VB 2005 version doesn't.
How do I make the label real transparent?
Thank you
Al