惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
V2EX
Y
Y Combinator Blog
博客园_首页
V
Visual Studio Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
阮一峰的网络日志
阮一峰的网络日志
Hugging Face - Blog
Hugging Face - Blog
宝玉的分享
宝玉的分享
B
Blog
博客园 - 三生石上(FineUI控件)
小众软件
小众软件
WordPress大学
WordPress大学
L
LangChain Blog
爱范儿
爱范儿
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Proofpoint News Feed
Blog — PlanetScale
Blog — PlanetScale
C
Check Point Blog
博客园 - 聂微东
云风的 BLOG
云风的 BLOG
Microsoft Security Blog
Microsoft Security Blog
博客园 - 叶小钗
酷 壳 – CoolShell
酷 壳 – CoolShell
H
Help Net Security

博客园 - 木人(我现在不是老大)

ERP系统的专业化发展趋势 讨厌的real和float数据 Svcutil使用点滴 windows server2003企业版64位安装sql server2008企业版64位 读书笔记 UltraGrid(16) 水晶报表使用push模式(2) 水晶报表使用push模式(1) SQL SERVER2000存储过程调试 读书笔记 UltraGrid(15) 读书笔记 UltraGrid(14) 读书笔记 UltraGrid(12) 读书笔记 UltraGrid(11) 读书笔记 UltraGrid(10) 读书笔记 UltraGrid(9) 读书笔记 UltraGrid(8) 读书笔记 UltraGrid(7) 读书笔记 UltraGrid(6) 读书笔记 UltraGrid(5) 读书笔记 UltraGrid(3)
读书笔记 UltraGrid(4)
木人(我现在不是老大) · 2012-02-09 · via 博客园 - 木人(我现在不是老大)

控制行高和列宽
缺省使用控件内部设定的行高和列宽,针对整个Grid所有的行和列;
this.ultraGrid.DisplayLayout.Override.DefaultColWidth=-1
this.ultraGrid.DisplayLayout.Override.DefaultRowHeight=-1
那实际的行高和行宽并不是-1,究竟是多少呢?
this.ultraGrid.Rows[0].Height,行高为20
this.ultraGrid.DisplayLayout.Bands[0].Columns[0].Width,列宽为133
也可以使用以下方法:
this.ultraGrid1.Rows[0].Cells[0].Width得到列宽;
this.ultraGrid.Rows[0].Height=30可以改变行所在的band内的所有行的高度,而不影响其它band内的行高!
这样说好像不能让某一行有特殊的高度的。
同理this.ultraGrid.DisplayLayout.Bands[0].Columns[0].Width = 200可改变列宽!
同样是针对Grid中的所有列的。
有疑问:ultraGrid所有band内列宽必须是一样的?
DevExpress这家公司的好像就没这个要求。
注意:
this.ultraGrid1.Rows[0].Cells[0].Width这个属性是只读哦,不能改变列宽哦。

同样如果针对每个band,则可以使用:
 this.ultraGrid1.DisplayLayout.Bands[i].Override.DefaultRowHeight = 30;
 this.ultraGrid1.DisplayLayout.Bands[i].Override.DefaultColWidth  = 100;
这样可以让每个band有不同的行高!
但列宽是一样的,并且是设置为最大的那个。这个有点奇怪。

补充:看来误解ultraGrid了。不是所有的band中的列宽都必须一样的。可以设置的,只是缺省如此。
this.ultraGrid.DisplayLayout.Override.AllowColSizing = AllowColSizing.Free
这样设置后,则列宽可以自由调整了。