Tulostaa formille tekstin varjolla eli 3D tyyliin.
' Käyttöesimerkki
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim texti = "Hello"
PrintVarjolla(texti, Color.Red, Color.Black, 28)
End SubSub PrintVarjolla(ByVal texti As String, ByVal colTeksti As Color, ByVal colVarjo As Color, ByVal fontinkoko As Single)
'muutetaan fontin kokoa
Me.Font = New System.Drawing.Font(Me.Font.Name, fontinkoko)
Dim varjo As Integer = Int(Me.Font.Size / 20 + 2)
'tehdään grafiikka-objekti joka piirtää formille
Dim g As System.Drawing.Graphics = Me.CreateGraphics()
' tehdään pensseli varjolle
Dim sbrush As New SolidBrush(colVarjo)
' pirretään varjo
g.DrawString(texti, Me.Font, sbrush, 20 + varjo, _
40 + varjo)
sbrush.Dispose() 'tuhotaan pensseli
' tehdään pensseli tekstille
Dim fbrush As New SolidBrush(colTeksti)
' piirretään teksti
g.DrawString(texti, Me.Font, fbrush, 20, 40)
fbrush.Dispose() 'tuhotaan pensseli
g.Dispose() 'tuhotan graf
End SubHieno! Tätähän voi tarvita vaikka missä!
Aihe on jo aika vanha, joten et voi enää vastata siihen.