更改datagridview中的列大小时,更改文本框的大小 [英] change the size of textbox when change the size of column in datagridview

查看:95
本文介绍了更改datagridview中的列大小时,更改文本框的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在gridview上方有两个文本框,在gridview中有两列.当更改gridview中的列大小然后动态更改各自的文本框大小时.

i have two textboxes above gridview and two column in gridview.when change the size of column in gridview then dynamically change the respective textbox size.

推荐答案

到gridview的ColumnWidthChanged事件.事件触发时,请查看事件参数e.它具有属性Column,该属性保存触发事件的列.

如果其Name将列名称之一与相应的文本框匹配,请读取列的宽度并设置相应文本框的宽度.
Hook in to the ColumnWidthChanged event of the gridview. When the event triggers, look at the event parameter e. It has a property, Column, which holds the column that triggered the event.

If its Name matches one of the column names with a corresponding text box, read the column''s width and and set the width of the corresponding text box.


这篇关于更改datagridview中的列大小时,更改文本框的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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