This project is read-only.

UseFont property?

Topics: User Forum
Dec 1, 2010 at 12:19 PM

I noticed the UseFont property isn't there anymore in the newer versions. When I wanted to change the font with the old versions which had the UseFont property, I simply set the new font using a font dialog which changed the font in the document.

Now the property isn't there anymore, when I set the new font it only affects the cursor, and some characters (such as ! and #) to the new font, everything else remains in the same font as it was before. How do I overcome this problem?

Dec 6, 2010 at 10:52 PM

I use a custom sub to set my font.

 

Public Sub SetFont(ByVal xFont As Font)

        xScintilla.Font = xFont

        xScintilla.Styles.Default.Font = xFont

        xScintilla.Styles(0).Font = xFont               'white space
        xScintilla.Styles(1).Font = xFont               'comments-block
        xScintilla.Styles(2).Font = xFont               'comments-singlechar
        xScintilla.Styles(3).Font = xFont               'half-formed comment
        xScintilla.Styles(4).Font = xFont               'numbers
        xScintilla.Styles(5).Font = xFont               'keyword after complete
        xScintilla.Styles(6).Font = xFont               'quoted text-double
        xScintilla.Styles(7).Font = xFont               'quoted text-single
        xScintilla.Styles(8).Font = xFont               '"table" keyword l
        xScintilla.Styles(9).Font = xFont               '? knows
        xScintilla.Styles(10).Font = xFont              'symbol (<>);=-
        xScintilla.Styles(11).Font = xFont              'half-formed words
        xScintilla.Styles(12).Font = xFont              'mixed quoted text 'text"  ?strange
        xScintilla.Styles(14).Font = xFont              'sql-type keyword (still looks weird)
        xScintilla.Styles(15).Font = xFont              'sql @symbol in a comment 
        xScintilla.Styles(16).Font = xFont              'sql function returning INT
        xScintilla.Styles(19).Font = xFont              'in/out
        xScintilla.Styles(32).Font = xFont              'plain ordinary whitespace, that exists everywhere

        xScintilla.Styles(ScintillaNet.StylesCommon.LineNumber).Font = xFont
        xScintilla.Styles(ScintillaNet.StylesCommon.BraceBad).Font = xFont
        xScintilla.Styles(ScintillaNet.StylesCommon.BraceLight).Font = xFont
        xScintilla.Styles(ScintillaNet.StylesCommon.CallTip).Font = xFont
        xScintilla.Styles(ScintillaNet.StylesCommon.ControlChar).Font = xFont
        xScintilla.Styles(ScintillaNet.StylesCommon.Default).Font = xFont
        xScintilla.Styles(ScintillaNet.StylesCommon.IndentGuide).Font = xFont
        xScintilla.Styles(ScintillaNet.StylesCommon.LastPredefined).Font = xFont
        xScintilla.Styles(ScintillaNet.StylesCommon.Max).Font = xFont

End Sub
Dec 7, 2010 at 11:22 AM

I was really hoping there would be another way to solve it rather than setting each style's font separately, it doesn't really make sense to change them all when it should be possible to just change the entire document's font at once. In the previous versions, it was as simple as changing one property. Nevertheless, thanks for the response.

Nov 1, 2013 at 2:46 PM
Edited Nov 2, 2013 at 11:59 AM
If you want something shorter try this ...
        Dim I As Integer
        For I = 0 To 255
            Scintilla1.Styles(I).FontName = "Envy Code R"  
            ' or whatever other font you want to use
            Scintilla1.Styles(I).Size = 14
        Next
FYI: xScintilla.Font = xFont ' this is the same as "Style0"
Also you probably do NOT want to change Style33 or Style Style 38 (Linenumbers and Calltips).