例: HeaderFontStyle property (NotesViewColumn - LotusScript®)

  1. 次のエージェントは、太字と斜体が設定されているかどうかを表示します。
    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.HeaderFontStyle And VC_FONT_BOLD) = _
      VC_FONT_BOLD Then
        msg1$ = "Bold is set"
      Else
        msg1$ = "Bold is not set"
      End If
      If (vc.HeaderFontStyle 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. 次のエージェントは、文字スタイルを太字から斜体 (斜体から太字) に切り替えます。
    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.HeaderFontStyle = VC_FONT_BOLD Then
        vc.HeaderFontStyle = VC_FONT_ITALIC
      Else
        vc.HeaderFontStyle = VC_FONT_BOLD
      End If
      Messagebox vc.FontStyle,, "New font style"
    End Sub
  3. 他の属性に影響を与えずに 1 つのスタイルを設定するには、次の形式の論理構成を使用します。
    vc.HeaderFontStyle = _
    vc.HeaderFontStyle Or VC_FONT_BOLD

    他の属性に影響を与えずに 2 つのスタイルを設定するには、次の形式の論理構成を使用します。

    vc.HeaderFontStyle = _
    vc.HeaderFontStyle Or VC_FONT_BOLD Or VC_FONT_ITALIC

    他の属性に影響を与えずに 1 つのスタイルの設定を解除するには、次の形式の論理構成を使用します。

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

    他の属性に影響を与えずに 2 つのスタイルの設定を解除するには、次の形式の論理構成を使用します。

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