我一直在考慮下面的方法:替代異或
Private Sub boldButton_Click(sender As System.Object, e As System.EventArgs) Handles boldButton.Click
Dim curFont As Font
Dim newFont As Font
curFont = rtb.SelectionFont
If curFont IsNot Nothing Then
'create the new font
newFont = New Font(curFont.FontFamily, curFont.Size, curFont.Style Xor FontStyle.Bold)
'set it
rtb.SelectionFont = newFont
End If
End Sub
目前有問題的理解是什麼的代碼curFont.Style Xor FontStyle.Bold
的這部分發生。在不使用operator
Xor
的情況下達到相同結果的有效方法是什麼?
編輯(如評論us2012)我需要一個替代?
我查過了Xor on MSDN,但仍然無法理解boldButton_Click
程序中的執行情況。
爲什麼你需要一種不同的方式,如果這個工程? – us2012 2013-02-28 07:53:38
@ us2012 - 因爲我不明白! ...另一種方法有望幫助我理解 – whytheq 2013-02-28 08:06:45
@ us2012 - 我想我會編輯這個問題。 – whytheq 2013-03-07 21:22:47