How to obtain form's inner width and height

余生颓废 提交于 2020-01-10 17:44:08

问题


As per title.

I am writing a program that all components can adjust size automatically by form's size.

When I using this.Width and this.Height properties, its return value is the width and height of whole form (red frame).

How to get the form's width and height of its inner area (green frame)?


回答1:


Use this.ClientSize.Width and this.ClientSize.Height.

http://msdn.microsoft.com/en-us/library/9278sfx2(v=vs.110).aspx




回答2:


Yes, You can check by this.ClientSize.Width and this.ClientSize.Height. Or you can put Panel in form and Dock fill and get this.panel1.width/ this.panel1.height as well.



来源:https://stackoverflow.com/questions/25539783/how-to-obtain-forms-inner-width-and-height

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!