在运行时拉伸表单窗口时最大化列表视图 [英] maximize listview when form window is strteched at runtime
问题描述
我正在使用 vb.net,我创建了一个表单,该表单中有两个列表视图由按钮事件填充.一切都很顺利,但问题是当我执行我的项目和表单时,当我最大化表单窗口(通过单击右上角提供的最大化按钮)时,列表视图的大小保持不变而表单最大化,这看起来奇怪的是,我需要的是随着窗体窗口大小的增加而最大化列表视图.
I am using vb.net, I have created a form and there are two listviews in that form which are getting filled by button event. Every thing is going smooth, but the problem is when my exeute my project and in the form, when I maximize the form window(by clicking maximize button provided in the top right corner) the size of listview remains same while form maximizes, this looks odd, what i need is to maximize the listview also with the increase in the form window size.
我在谷歌上搜索了很多,我发现了一个列表视图的属性dock",我可以设置左、完整、右、底部、顶部或无,但这不符合我的目的.
I searched in google a lot and i found one property 'dock' of listview which i can set left, full, right,bottom,top or none, but this doesn't serve my purpose.
我使用 Anchor 属性时的快照开始时:
Snapshot when I am using Anchor property On Starting:
最大化后:请指导我正确的方向,我需要做什么
After Maximizing: Please guide me in the right direction, what I need to do
当没有设置属性时,最大化时的图像是:谢谢
when no propety is set then image on maximizing is: Thank you
问候
推荐答案
比 Dock 属性更好,你必须使用Anchor"属性.Form上的所有控件默认都有Anchor Top,Left,但是你可以在属性窗口或者直接通过代码修改.你可以在这个网站上了解更多关于锚的信息:http://www.homeandlearn.co.uk/NET/nets13p1.html
Better than Dock property, you have to use "Anchor" property. All controls on the Form has Anchor Top,Left by default, but you can change it in the property window or directly by code. You can know more about anchor on this site: http://www.homeandlearn.co.uk/NET/nets13p1.html
在表单上锚定两个 Listview 取决于表单设计,但是如果您希望两个 Listview 在表单调整大小时更改大小,SplitContainer 控件将非常有用.
Anchoring two Listviews on a form depends on the form design, but SplitContainer control will be really usefull if you want that both Listview changes the size on form resize.
这篇关于在运行时拉伸表单窗口时最大化列表视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!