how to draw GDI Text with shadow effect in

following example shows that how to add shadow to text or how to draw gdi text with shadow effect in

example contains one picture box on which we will create text with shadow effect.

Private Sub DrawShadowText()
Dim textSize As SizeF
Dim g As Graphics
Dim ForeColor As Color = lbltextColor.BackColor
Dim ShadowColor As Color = lblShadowColor.BackColor
Dim myForeBrush As New SolidBrush(ForeColor)
Dim myShadowBrush As New SolidBrush(ShadowColor)
Dim xLocation, yLocation As Single
' Create a Graphics object from the picture box & clear it.
g = PictureBox1.CreateGraphics()
Dim fontconverter As New FontConverter
Dim myFont As Font
myFont = fontconverter.ConvertFromString(txtFont.Text)
' Find the Size required to draw the Sample Text.
textSize = g.MeasureString(Me.txtText.Text, myFont)
' Get the locations once to eliminate redundant calculations.
xLocation = (PictureBox1.Width - textSize.Width) / 2
yLocation = (PictureBox1.Height - textSize.Height) / 2
' Draw the Shadow first.
g.DrawString(txtText.Text, myFont, myShadowBrush, _
xLocation + Me.cmbDepth.Value, _
yLocation + Me.cmbDepth.Value)
' Draw the Main text over the shadow.
g.DrawString(txtText.Text, myFont, myForeBrush, xLocation, yLocation)
End Sub