Examples: FontStyle property

  1. This agent indicates whether bold is set and whether italic is set.
    Sub Initialize
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim view As NotesView
      Dim vc As NotesViewColumn
      Set db = session.CurrentDatabase
      Set view = db.GetView("Categorized")
      Set vc = view.Columns(0)
      If (vc.FontStyle And VC_FONT_BOLD) = VC_FONT_BOLD Then
        msg1$ = "Bold is set"
      Else
        msg1$ = "Bold is not set"
      End If
      If (vc.FontStyle And VC_FONT_ITALIC) = _
      VC_FONT_ITALIC Then
        msg2$ = "Italic is set"
      Else
        msg2$ = "Italic is not set"
      End If
      Messagebox msg1$ & Chr(13) & msg2$,, "Font styles"
    End Sub
  2. This agent toggles the font style between bold and italic.
    Sub Initialize
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim view As NotesView
      Dim vc As NotesViewColumn
      Set db = session.CurrentDatabase
      Set view = db.GetView("Categorized")
      Set vc = view.Columns(0)
      If vc.FontStyle = VC_FONT_BOLD Then
        vc.FontStyle = VC_FONT_ITALIC
      Else
        vc.FontStyle = VC_FONT_BOLD
      End If
      Messagebox vc.FontStyle,, "New font style"
    End Sub
  3. To set a style without disturbing the others, use a logical construct of the following form:
    vc.FontStyle = _
    vc.FontStyle Or VC_FONT_BOLD

    To set two styles without disturbing the others, use a logical construct of the following form:

    vc.FontStyle = _
    vc.FontStyle Or VC_FONT_BOLD Or VC_FONT_ITALIC

    To unset a style without disturbing the others, use a logical construct of the following form:

    vc.FontStyle = _
    vc.FontStyle And (Not VC_FONT_BOLD)

    To unset two styles without disturbing the others, use a logical construct of the following form:

    vc.FontStyle = _
    vc.FontStyle And (Not (VC_FONT_BOLD Or VC_FONT_ITALIC))