社区
C#
帖子详情
怎样调整表中列的宽度使其填满整个datagrid
yhtzyx
2006-06-20 05:09:55
不知该如何是好,在线等
...全文
282
2
打赏
收藏
怎样调整表中列的宽度使其填满整个datagrid
不知该如何是好,在线等
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
yhtzyx
2006-06-20
打赏
举报
回复
这样写到是可以,但不能随着窗口的大小变动,能实现动态的吗
nikita007
2006-06-20
打赏
举报
回复
就是在你的formload里添加tablestyle就可以
private void AddCustomDataTableStyle()
{
DataGridTableStyle ts1 = new DataGridTableStyle();
ts1.MappingName = "SUP";
// 设置属性
ts1.AlternatingBackColor = Color.LightGray;
// 添加Textbox列样式,以便我们捕捉鼠标事件
DataGridTextBoxColumn TextCol = new DataGridTextBoxColumn();
TextCol.MappingName = "SUP_CONTRACT_NO";
TextCol.HeaderText = "CONTRACT NO";
TextCol.Width = 50;
TextCol.ReadOnly = true;
//添加事件处理器
TextCol.TextBox.Click += new EventHandler(TextBoxDoubleClickHandler);
ts1.GridColumnStyles.Add(TextCol);
TextCol = new DataGridTextBoxColumn();
TextCol.MappingName = "SUP_NO";
TextCol.HeaderText = "SUPPLIER NO";
TextCol.Width = 100;
TextCol.ReadOnly = true;
TextCol.TextBox.Click += new EventHandler(TextBoxDoubleClickHandler);
ts1.GridColumnStyles.Add(TextCol);
TextCol = new DataGridTextBoxColumn();
TextCol.MappingName = "SECTIONID";
TextCol.HeaderText = "SECTIONID";
TextCol.Width = 100;
TextCol.ReadOnly = true;
TextCol.TextBox.Click += new EventHandler(TextBoxDoubleClickHandler);
ts1.GridColumnStyles.Add(TextCol);
TextCol = new DataGridTextBoxColumn();
TextCol.MappingName = "START_DATE";
TextCol.HeaderText = "START DATE";
TextCol.Width = 100;
TextCol.ReadOnly = true;
TextCol.TextBox.Click += new EventHandler(TextBoxDoubleClickHandler);
ts1.GridColumnStyles.Add(TextCol);
TextCol = new DataGridTextBoxColumn();
TextCol.MappingName = "END_DATE";
TextCol.HeaderText = "END DATE";
TextCol.Width = 100;
TextCol.ReadOnly = true;
TextCol.TextBox.Click += new EventHandler(TextBoxDoubleClickHandler);
ts1.GridColumnStyles.Add(TextCol);
TextCol = new DataGridTextBoxColumn();
TextCol.MappingName = "SERVICE_NO";
TextCol.HeaderText = "SERVICE NO";
TextCol.Width = 100;
TextCol.ReadOnly = true;
TextCol.TextBox.Click += new EventHandler(TextBoxDoubleClickHandler);
ts1.GridColumnStyles.Add(TextCol);
TextCol = new DataGridTextBoxColumn();
TextCol.MappingName = "C_FLAG";
TextCol.HeaderText = "Collection Flag";
TextCol.Width = 100;
TextCol.ReadOnly = true;
TextCol.TextBox.Click += new EventHandler(TextBoxDoubleClickHandler);
ts1.GridColumnStyles.Add(TextCol);
TextCol = new DataGridTextBoxColumn();
TextCol.MappingName = "LP_ID";
TextCol.HeaderText = "LOGISTIC PROVIDER ID";
TextCol.Width = 100;
TextCol.ReadOnly = true;
TextCol.TextBox.Click += new EventHandler(TextBoxDoubleClickHandler);
ts1.GridColumnStyles.Add(TextCol);
ts1.SelectionBackColor = System.Drawing.Color.Blue;
dataGrid1.TableStyles.Add(ts1);
}
datagrid
vie行高列宽_
DataGrid
View列的
宽度
、行的高度自动
调整
注意:
DataGrid
View控件是从.NET Framework2.0版本开始...内容变更时自动
调整
列的
宽度
自动
调整
DataGrid
View列的
宽度
自动
调整
,可以使用
DataGrid
View.AutoSizeColumnsMode属性实现。下面的代码就是列的
宽度
根据Hea...
easyui多表头不足以撑开
整个
页面解决方法
flag: false, //设置为 true,则当 'fitColumns' 设置为 true 时放置
调整
宽度
columns中有width时生效 idField: 'lvrecId', // 指示哪个字段是标识字段 loadMsg: 'Loading...', // 当从远程站点加载数据时,显示的...
[随手笔记] easyui
datagrid
自适应高度
currentListObj.
datagrid
({ url: '/Workstation/GetList', queryParams: ParamList(), methord: 'post', ... fit: true,//添加fit属性,添加这个属性后,
datagrid
可以不要
宽度
和高度,默认
填满
父级 checkb...
DataGrid
View控件小结
3.
填满
窗口,自适应于控件放在的窗口Form中,随着窗口大小变化而变化。
dataGrid
View1.Width =Form1.Width;
dataGrid
View1.Height = Form1.Height;
dataGrid
View1.Top = 0;
dataGrid
View1.Left= 0; ...
C#
dataGrid
View控件,设置自动/手动列宽、文本居中、禁止列排序
for (int i = 0; i <
dataGrid
View.Columns.Count; i++) {
dataGrid
View.Columns[i].SortMode = ... //禁止列排序
dataGrid
View.Columns[i].AutoSizeMode =
DataGrid
ViewAutoSizeColumnMode.AllCells;
C#
110,534
社区成员
642,575
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章