Atalasoft
Welcome to Atalasoft Community Sign in | Join | Help
in

Font underline /strikeout on annotations

Last post 28 Jan 2007, 11:10 AM by Glenn. 1 replies.
Sort Posts: Previous Next
  •  28 Jan 2007, 6:07 AM 11323

    Font underline /strikeout on annotations

    Hi!

    I am using DotAnnotate 3.0. I am using the AnnotateViewer 

    I am trying to let the users change the fonts on an annotation. This is my code below that gets fired when they right click on the selected annotation. What is driving me crazy is that the FontDialog comes up with the Strikeout and the underlined checkboxes already checked even though the text in the original annotation is not underlined or struck out. Am I missing something?

    Thanks for your help!

    Dim txt As Atalasoft.Imaging.Annotate.TextAnnotation
    Dim MyFontDialog As New Windows.Forms.FontDialog
    txt =
    CType(ImageViewer.Annotations.ActiveAnnotation, TextAnnotation)
    Dim CurrentFont As New Font(txt.Font, txt.Font.Size)

    MyFontDialog.ShowEffects = True
    MyFontDialog.ShowColor = False
    MyFontDialog.FontMustExist = True
    MyFontDialog.ShowApply = False
    MyFontDialog.Font = CurrentFont

    If MyFontDialog.ShowDialog = Windows.Forms.DialogResult.OK Then

    txt.Font = MyFontDialog.Font

    ImageViewer.Annotations.ActiveAnnotation.Refresh()

    End If

    End If

    Catch ex As Exception

    MsgBox("blah, blah: " & ex.Message, MsgBoxStyle.Critical)

    End Try

  •  28 Jan 2007, 11:10 AM 11324 in reply to 11323

    Re: Font underline /strikeout on annotations

    It's becaues you are setting those features when you create CurrentFont.  The constructor you are using takes a Font and FontStyle, not font size.  It just happens that the Size value results in a FontStyle with Strikeout and Underline enabled.

    A better way would be to use the Font.Clone method to get a copy of the annotation font.

    Dim CurrentFont As Font = CType(txt.Font.Clone(), Font)


    Glenn Chittenden Jr.
    Atalasoft Development Team
View as RSS news feed in XML