我一直在考虑下面的方法:替代异或
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