c#列自动宽度取决于表单分辨率 [英] c# columns automatic width depending to form resolution

查看:63
本文介绍了c#列自动宽度取决于表单分辨率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我的表格中有datagridview,里面有SQL列,我用这段代码设置宽度的那些列:

dataGridView1.Columns [name ]。宽度= 353;



问题是,当我运行此程序时,当我最大化窗体大小时,这些列不会自动调整宽度(同时datagridview会自动调整大小和填充整个表单,因为我设置了ANCHOR,但列的宽度与之前相同)。



有没有办法设置这些列最小宽度和自动调整大小它们取决于表格的大小?



提前谢谢

解决方案

我解决了这个问题的最小宽度。

Hello guys,
I have datagridview in my form which has SQL columns inside, to those columns I set width with this code:
dataGridView1.Columns["name"].Width = 353;

Problém is that those columns doesnt automatically resize width when I maximize size of form when i run this program(also datagridview automatically resizes and fills the whole form because i set ANCHOR to it, but columns has the same width as before).

Is there any way to set to those columns min width and auto resize them depending to the size of form?

Thanks in advance

解决方案

I solved this usisng MinimumWidth.


这篇关于c#列自动宽度取决于表单分辨率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆