Line number margin font color

SyntaxEditor for Windows Forms Forum

Posted 15 years ago by Alexey
Avatar
How I can change line number margin font color for printing document?
Default green in laser printer copy looks ugly.

Comments (4)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Alexey,

It looks like it uses the setting in the renderer right now for line number margin color. You'd have to update the renderer when you print and then set it back when done probably. Either that or create a new SyntaxEditor in the background with the same settings but use an instance specific renderer there and tweak the color on that, then print from that.


Actipro Software Support

Posted 15 years ago by Alexey
Avatar
Thanks for answer!

Quote:
create a new SyntaxEditor in the background


I do the same things when switching off colors of parsed text in syntaxEditor.PrintSettings.PrintDocument.BeginPrint and syntaxEditor.PrintSettings.PrintDocument.EndPrint event handlers just by setting editor.Document.LexicalParsingEnabled in false or true. But I can't find out how definitely do
Quote:
use an instance specific renderer
or
Quote:
update the renderer
.

Can you write some code for example, please?
Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Alexey,

Sure just create a new instance of VisualStudio2005SyntaxEditorRenderer and change the line number color. Then set that to the SyntaxEditor.Renderer property. That will cause SyntaxEditor to use the instance renderer you created instead of the global renderer. The renderer currently being used is always available in RendererResolved. So if you set Renderer to null, RenderResolved will revert back to being the global renderer.


Actipro Software Support

Posted 15 years ago by Alexey
Avatar
Hi,

It really works.

        void PrintDocument_BeginPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            SyntaxEditor editor = GetCurrentSyntaxEditor();
            editor.Document.LexicalParsingEnabled = false; // for text colors 

            VisualStudio2005SyntaxEditorRenderer renderer = new VisualStudio2005SyntaxEditorRenderer();
            renderer.LineNumberMarginForeColor = Color.Black; // for line number color
            editor.Renderer = renderer;
            return;
           
        }

        void PrintDocument_EndPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            SyntaxEditor editor = GetCurrentSyntaxEditor();
            editor.Document.LexicalParsingEnabled = true; // for text colors 

            editor.Renderer = null; // for line number color
            return;
        }
Thanks a lot!
The latest build of this product (v24.1.0) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.