Private Sub Picture1_Resize()
Const FW_NORMAL = 400 ' Normal font weight.
Const FW_BOLD = 700 ' Bold font weight.
Const FONT_SIZE = 20
Dim txt As String
Dim wid As Single
Dim hgt As Single
Dim X As Single
Dim Y As Single
Picture1.AutoRedraw = True
Picture1.ScaleMode = vbPixels
Picture1.Cls
' Upper left.
txt = "Upper Left"
SelectFont Picture1, "Times New Roman", _
FONT_SIZE, FW_BOLD, 900, False, False, False
wid = Picture1.TextWidth(txt)
hgt = FONT_SIZE
X = 0
Y = wid
Picture1.CurrentX = X
Picture1.CurrentY = Y
Picture1.Print txt
Picture1.Line (X, Y)-Step(hgt, -wid), , B
DeselectFont Picture1
' Upper right.
txt = "Upper Right"
SelectFont Picture1, "Times New Roman", _
FONT_SIZE, FW_BOLD, 900, False, False, False
wid = Picture1.TextWidth(txt)
hgt = FONT_SIZE
X = Picture1.ScaleWidth - hgt
Y = wid
Picture1.CurrentX = X
Picture1.CurrentY = Y
Picture1.Print txt
Picture1.Line (X, Y)-Step(hgt, -wid), , B
DeselectFont Picture1
' Lower left.
txt = "Lower Left"
SelectFont Picture1, "Times New Roman", _
FONT_SIZE, FW_BOLD, 900, False, False, False
wid = Picture1.TextWidth(txt)
hgt = FONT_SIZE
X = 0
Y = Picture1.ScaleHeight
Picture1.CurrentX = X
Picture1.CurrentY = Y
Picture1.Print txt
Picture1.Line (X, Y)-Step(hgt, -wid), , B
DeselectFont Picture1
' Lower right.
txt = "Lower Right"
SelectFont Picture1, "Times New Roman", _
FONT_SIZE, FW_BOLD, 900, False, False, False
wid = Picture1.TextWidth(txt)
hgt = FONT_SIZE
X = Picture1.ScaleWidth - hgt
Y = Picture1.ScaleHeight
Picture1.CurrentX = X
Picture1.CurrentY = Y
Picture1.Print txt
Picture1.Line (X, Y)-Step(hgt, -wid), , B
DeselectFont Picture1
' Center.
txt = "Center"
SelectFont Picture1, "Times New Roman", _
FONT_SIZE, FW_BOLD, 900, False, False, False
wid = Picture1.TextWidth(txt)
hgt = FONT_SIZE
X = (Picture1.ScaleWidth - hgt) / 2
Y = (Picture1.ScaleHeight + wid) / 2
Picture1.CurrentX = X
Picture1.CurrentY = Y
Picture1.Print txt
Picture1.Line (X, Y)-Step(hgt, -wid), , B
DeselectFont Picture1
Picture1.Line (0, 0)-(Picture1.ScaleWidth, _
Picture1.ScaleHeight)
Picture1.Line (0, _
Picture1.ScaleHeight)-(Picture1.ScaleWidth, 0)
End Sub
|