Hi
ich habe momentan Probleme mit einer Umkehrung der Fontstyles:
Das funktioniert alles wunderbar, wenn mans einschaltet. Aber wenn mans wieder abschalten will, wird der Font einfach ganz umgekehrt... (ist nicht Regular)
Kann mir irgendwer voneuch sagen was ich falsch mache?
Gruß
~blaze~
ich habe momentan Probleme mit einer Umkehrung der Fontstyles:
VB.NET-Quellcode
- Public Function InverseFontStyle(ByVal DefaultFontStyle As FontStyle, ByVal ParamArray FontStylesToInverse() As FontStyle) As Integer
- 'Regular = 0
- 'Bold = 1
- 'Italic = 2
- 'Underline = 4
- 'Strikeout = 8
- Dim fontstyle As Integer = DefaultFontStyle
- For Each Style As FontStyle In FontStylesToInverse
- If Style = Drawing.FontStyle.Bold Then
- If DefaultFontStyle = Drawing.FontStyle.Bold Then
- fontstyle -= 1
- Else
- fontstyle += 1
- End If
- ElseIf Style = Drawing.FontStyle.Italic Then
- If DefaultFontStyle = Drawing.FontStyle.Italic Then
- fontstyle -= 2
- Else
- fontstyle += 2
- End If
- ElseIf Style = Drawing.FontStyle.Underline Then
- If DefaultFontStyle = Drawing.FontStyle.Underline Then
- fontstyle -= 4
- Else
- fontstyle += 4
- End If
- ElseIf Style = Drawing.FontStyle.Strikeout Then
- If DefaultFontStyle = Drawing.FontStyle.Strikeout Then
- fontstyle -= 8
- Else
- fontstyle += 8
- End If
- ElseIf Style = Drawing.FontStyle.Regular Then
- If fontstyle = 15 Then
- fontstyle = 0
- Else
- fontstyle = 15
- End If
- End If
- Next
- Return fontstyle
- End Function
Das funktioniert alles wunderbar, wenn mans einschaltet. Aber wenn mans wieder abschalten will, wird der Font einfach ganz umgekehrt... (ist nicht Regular)
Kann mir irgendwer voneuch sagen was ich falsch mache?
Gruß
~blaze~