Reputation: 21
I am refactoring a Windows Forms application to scale properly with high DPI settings. This application uses WeiFen Luo's 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?
Upvotes: 2
Views: 823
Reputation: 2499
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:
tab font
/ tab page font
and rescale itIf 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();
Upvotes: 0