1

I am refactoring a Windows Forms application to scale properly with high DPI settings. This application uses DockPanelSuite library to dock some of its tools (DockArea.DockLeft) and the main view area (DockArea.Document).

My problem is that main view area tab strip width is often smaller than enclosed caption text width, as you can see here. Also, when form is scaled (because moved between screens with differed DPI settings) tab strip buttons are not scaled properly (see here).

I've tried modifying Font size using these properties:

dockPanel1.Theme.Skin.DockPaneStripSkin.TextFont dockPanel1.Theme.Skin.AutoHideStripSkin.TextFont

But they do not scale the strip container, only the text inside it. What can I do to scale tab strip width and buttons in the correct way?

  • Patches are welcome as GitHub pull requests, but currently this library does not have much High DPI support. – Lex Li Oct 05 '18 at 14:16
  • I see. I have downloaded dockpanel-suite sources from GitHub and I have read some code (mainly in Themes part), but I can't figure out how to modify code in a proper way. Do you have hint on how to do? – Alessio Iotti Oct 05 '18 at 15:05
  • Unfortunately there is no enough documentation, except http://docs.dockpanelsuite.com/themes/basics.html In most cases, you have to refer to previous commit I made so as to understand what are the building blocks. I also had a few blog posts, https://blog.lextudio.com/tagged/dockpanel-suite – Lex Li Oct 05 '18 at 16:55
  • Thank you, I will check blog posts and I will try to modify dockpanel suite code to di the scaling I need. Maybe I will also add some commit to GitHub (I'm not sure at the moment, it depends on quality of my future changes :-D ) – Alessio Iotti Oct 05 '18 at 18:26

1 Answers1

0

First you should look at code that is used for scaling. Obviously it scales tab headers vertical and horizontal but not it's text.

There are two possible solutions to this:

  • Rewrite code used for scaling so it also get's tab font/ tab page font and rescale it
  • Create custom extension method

If you go for second method just simple create extension method look at TextRenderer class to measure free space and font size it should go there and then use tab.Font to change font on all tabPages at once or tabPage.Font to change it for each.

Then when you initialize everything just call this method yourTabControl.ResizeFonts();

Aleksa Ristic
  • 2,394
  • 3
  • 23
  • 54
  • Sorry, maybe I have not understood what you explained. It seems to me that you are talking about scaling the tab strips of a .NET `TabControl` control. My question is about how to scale the tab strips of a `WeifenLuo.WinFormsUI.Docking.DockPane` control (WeifenLuo.WinFormsUI.Docking is a third-party DLL). – Alessio Iotti Oct 03 '18 at 13:56