Zooming using Ctrl+Mouse Wheel

SyntaxEditor for Windows Forms Forum

Posted 14 days ago by AF
Version: 20.1.0402
Avatar

Do you have any plans to implement zooming in WinForms?

Comments (4)

Posted 14 days ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Sorry but not at this time.  WinForms is drawn by pixel and isn't vector-based like WPF/UWP, so it wouldn't scale well.


Actipro Software Support

Posted 13 days ago by AF
Avatar

Thanks, but I'm not sure that would be an issue as Fonts and simple drawing code like Margins would scale OK?

You could probably do all the scaling in OnPaint by adjusting ScaleTransform, TranslateTransform and AutoScrollPosition on the Graphics object for the current zoom level (I do similar for my own controls).

I can sort of work around this by scaling the Font myself (this obviously scales well), but the margins (width, font, glyphs) would also need scaling and I'm not sure what control I have over these?

Answer - Posted 13 days ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

It's a bit of a long story but we ported the SyntaxEditor API from the WPF version to the WinForms platform in v2020.1.  We made some compatibility shims for rendering in WinForms and built an entire text rendering framework in WinForms to properly render text with cultural sensitivity.  The WinForms SyntaxEditor isn't just using straight GDI+ rendering behind the scenes.  A good chunk of SyntaxEditor (especially in the text area) is using native classic Win32 GDI rendering because it paints MUCH faster and arranges text more accurately than GDI+.  Some portions of SyntaxEditor UI are still GDI+ though, and other portions are even embedded controls like ScrollBars.  When you combine all the forms of rendering, we can scale some things ok but other pieces don't scale or arrange correctly, and also mouse input doesn't transform itself according to the scale.  Basically we've looked at it and there are a lot of issues that would need solved.  It's all much easier in platforms like WPF and UWP since you set a single scale transform property there and everything from rendering to input is fully handled.  In WinForms, a lot of that needs to be manually handled.

If you wanted to change the line number margin font, you can do so by altering the HighlightingStyleRegistry's style entry for DisplayItemClassificationTypes.LineNumbers.  The margin examines the style.FontFamilyName and FontSize on that if specified.


Actipro Software Support

Posted 12 days ago by AF
Avatar

OK, thanks.

The latest build of this product (v2020.1 build 0403) was released 7 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.