Schrift mit Rand- und Füllfarben

Leserbewertung(1):bewerten...
kommentieren...
Hans Happel

Wenn Sie es leid sind immer nur einfarbige Schriften zu haben, dann ist dieses Beispiel das Richtige für Sie.

Erstellen Sie eine Form mit 2 Buttons und geben Sie folgendes in den Deklarationsabschnitt ein:

Private Declare Function BeginPath Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function FillPath Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function StrokePath Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function StrokeAndFillPath Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function EndPath Lib "gdi32" (ByVal hdc As Long) As Long

So sollte das Command1_Click-Ereignis aussehen:

Private Sub Command1_Click()
Me.Cls
With Font
.Name = "Arial"
.Bold = True
.Italic = False
.Size = 72
End With
ForeColor = vbBlack
FillColor = vbRed
FillStyle = vbDiagonalCross
DrawWidth = 3
BeginPath Me.hdc
Me.Print "HBsoft"
EndPath Me.hdc
StrokeAndFillPath Me.hdc
End Sub

Das Command2_Click-Ereignis sieht so aus

Private Sub Command2_Click()
Me.Cls
With Font
.Name = "Arial"
.Bold = True
.Italic = True
.Size = 99
End With
ForeColor = RGB(0, 0, 255)
FillColor = QBColor(14)
FillStyle = 0
DrawWidth = 12
BeginPath Me.hdc
Me.Print "HBsoft"
EndPath Me.hdc
StrokeAndFillPath Me.hdc
DrawWidth = 3
ForeColor = QBColor(11)
CurrentY = 0
BeginPath Me.hdc
Me.Print "HBsoft"
EndPath Me.hdc
StrokeAndFillPath Me.hdc
End Sub

Dies sind nur 2 Beispiele von sehr vielen Möglichkeiten. Experimentieren Sie mit den Eigenschaften ForeColor, FillColor, FillStyle und DrawWidth und erzeugen Sie ihr persönliches Schriftbild.