This example uses the GetSelectedAnnotationFont method to determine the font attributes of a selected annotation. It then updates the Microsoft common dialog box to indicate the attributes obtained.
This example also uses the Microsoft common dialog box and the SetSelectedAnnotationFont method to change the font attributes of a selected annotation.
Private Sub cmdGetAnnoFont_Click()
'This example uses the Microsoft font dialog box to
'change a selected text annotation mark's font.
Dim AnnoFont As IFontDisp
Dim FontColor As Long
'Determine the current font used in the selected annotation
'mark and init the dialog box font property to that font.
Set AnnoFont = ImgEdit1.GetSelectedAnnotationFont
FontColor = ImgEdit1.GetSelectedAnnotationFontColor
CommonDialog1.FontName = AnnoFont.Name
CommonDialog1.FontBold = AnnoFont.Bold
CommonDialog1.FontItalic = AnnoFont.Italic
CommonDialog1.FontSize = AnnoFont.Size
CommonDialog1.FontUnderline = AnnoFont.Underline
CommonDialog1.FontStrikethru = AnnoFont.Strikethrough
CommonDialog1.Color = FontColor
CommonDialog1.Flags = cdlCFScreenFonts Or cdlCFEffects
CommonDialog1.ShowFont
'Take values set in the font dialog box and set these
'attributes in the annotation font.
AnnoFont.Name = CommonDialog1.FontName
AnnoFont.Bold = CommonDialog1.FontBold
AnnoFont.Italic = CommonDialog1.FontItalic
AnnoFont.Size = CommonDialog1.FontSize
AnnoFont.Underline = CommonDialog1.FontUnderline
AnnoFont.Strikethrough = CommonDialog1.FontStrikethru
'Apply the new font and font color to the selected
'annotation.
ImgEdit1.SetSelectedAnnotationFont AnnoFont
ImgEdit1.SetSelectedAnnotationFontColor CommonDialog1.Color
End Sub