Alessio Iotti
Alessio Iotti

Reputation: 21

Resize dock pane tab strip text and buttons in Document docked DockContent

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

Answers (1)

Aleksa Ristic
Aleksa Ristic

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:

  • 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();

Upvotes: 0

Related Questions