开发者

Dynamically Scaled UIs with VB.NET WinForms?

I'm wondering if anyone is familiar with designing UIs to be scalable to any resolution. Are there any libraries or functionalities of .NET that make this easy? We also have开发者_StackOverflow社区 Infragistics controls as a resource.


With Windows Forms, the best option is to use the dynamically generated layout controls, and make sure to use the Anchor/Dock properties of controls for placement, instead of positioning and sizing explicitly.

The layout panels, such as TableLayoutPanel, also help tremendously, since they do dynamic resizing at runtime.

That being said, this is one place where WPF has a huge advantage over Windows Forms. In WPF, all sizing and layout is done with a "pixel" being a virtualized, resolution indepdent "pixel" which corresponds to 1/96th inch. This means your UI will just work on any resolution, provided you don't explicitly mess it up.


Use a TableLayoutPanel. You can then lay out a grid that is scalable (you can use a mix of fixed width/height and variable based on percentages), and then dock/anchor the UI components to the table cells.

TableLayoutPanel Members (System.Windows.Forms)


FWIW, you should always bear in mind that the user can switch the size of their default font in Display Settings from Control Panel. There are still some controls that don't properly handle this sizing issue, so you should be careful of assumptions you make regarding expected size.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜