none
字變粗變斜底線的邏輯問題 RRS feed

  • 問題

  •     Private Sub chkB_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles chkB.CheckedChanged
            If chkB.Checked And chkI.Checked And chkU.Checked Then
                lblOutput.Font = New Font("arial", CSng(cboSize.Text), FontStyle.Bold Or FontStyle.Italic Or FontStyle.Underline) '字型,大小,樣式
            ElseIf chkB.Checked And chkI.Checked Then
                lblOutput.Font = New Font("arial", CSng(cboSize.Text), FontStyle.Bold Or FontStyle.Italic)
            ElseIf chkB.Checked And chkU.Checked Then
                lblOutput.Font = New Font("arial", CSng(cboSize.Text), FontStyle.Bold Or FontStyle.Underline)
            ElseIf chkI.Checked And chkU.Checked Then
                lblOutput.Font = New Font("arial", CSng(cboSize.Text), FontStyle.Italic Or FontStyle.Underline)
            ElseIf chkB.Checked Then
                lblOutput.Font = New Font("arial", CSng(cboSize.Text), FontStyle.Bold)
            ElseIf chkI.Checked Then
                lblOutput.Font = New Font("arial", CSng(cboSize.Text), FontStyle.Italic)
            ElseIf chkU.Checked Then
                lblOutput.Font = New Font("arial", CSng(cboSize.Text), FontStyle.Underline)
            Else
                lblOutput.Font = New Font("arial", CSng(cboSize.Text), FontStyle.Regular)
            End If
        End Sub
    設計很簡單
    三個鈕B、I、U
    都是上面的CODE

    想知道為什麼是OR
    而不是用AND呢?

    試過用AND 跑出來就錯了
    只是普通的宅宅
    2009年5月8日 下午 05:45

解答

所有回覆