How to make 3D Text in Label
Posted on January 5, 2009
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | 'Controls - How to make 3D Text in Label Option Explicit 'Add a Command Button to your form and three Labels. Global Const GFM_STANDARD = 0 Global Const GFM_RAISED = 1 Global Const GFM_SUNKEN = 2 Global Const GFM_BACKSHADOW = 1 Global Const GFM_DROPSHADOW = 2 Global Const BOX_WHITE& = &HFFFFFF Global Const BOX_LIGHTGRAY& = &HC0C0C0 Global Const BOX_DARKGRAY& = &H808080 Global Const BOX_BLACK& = &H0& Static Sub FormLabelCaptionEmbossed(lbl1 As Label, L2 As Label, L3 As Label, label_text As String, label_effect As Integer, label_forecolor As Long, label_depth As Integer) Dim lt As String Dim savesm As Integer Dim f As Form Set f = lbl1.Parent lbl1.Visible = False L2.Visible = False L3.Visible = False savesm = f.ScaleMode f.ScaleMode = 3 If label_text = "" Then lt = lbl1 Else lt = label_text End If lbl1 = lt L2 = lt L3 = lt lbl1.BackStyle = 0 lbl1.Forecolor = label_forecolor L2.Width = lbl1.Width L2.Height = lbl1.Height L2.BackStyle = lbl1.BackStyle L2.Forecolor = BOX_DARKGRAY& L3.Width = lbl1.Width L3.Height = lbl1.Height L3.BackStyle = lbl1.BackStyle L3.Forecolor = BOX_WHITE& Select Case label_effect Case GFM_SUNKEN L2.Left = lbl1.Left - label_depth L2.Top = lbl1.Top - label_depth L3.Left = lbl1.Left + label_depth L3.Top = lbl1.Top + label_depth Case GFM_RAISED L2.Left = lbl1.Left + label_depth L2.Top = lbl1.Top + label_depth L3.Left = lbl1.Left - label_depth L3.Top = lbl1.Top - label_depth End Select f.ScaleMode = savesm lbl1.Visible = True L2.Visible = True L3.Visible = True lbl1.ZOrder End Sub Private Sub Command1_Click() 'Replace 'CodeItBetter' with the text you want to display, 'Replace the first '1' with '2' to change the 3D effect. 'Replace 'vbBlack' with the Text Color. FormLabelCaptionEmbossed Label1, Label2, Label3, "CodeItBetter", 1, vbBlack, 1 End Sub |