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

推荐订阅源

K
Kaspersky official blog
T
Threat Research - Cisco Blogs
N
News and Events Feed by Topic
Hacker News: Ask HN
Hacker News: Ask HN
Project Zero
Project Zero
Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - 叶小钗
Security Latest
Security Latest
Spread Privacy
Spread Privacy
aimingoo的专栏
aimingoo的专栏
N
News and Events Feed by Topic
Webroot Blog
Webroot Blog
U
Unit 42
Cyberwarzone
Cyberwarzone
小众软件
小众软件
Scott Helme
Scott Helme
Engineering at Meta
Engineering at Meta
Microsoft Security Blog
Microsoft Security Blog
T
The Blog of Author Tim Ferriss
A
About on SuperTechFans
爱范儿
爱范儿
S
Schneier on Security
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Schneier on Security
Schneier on Security
Latest news
Latest news
GbyAI
GbyAI
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
The Register - Security
The Register - Security
WordPress大学
WordPress大学
博客园_首页
Blog — PlanetScale
Blog — PlanetScale
PCI Perspectives
PCI Perspectives
Jina AI
Jina AI
AI
AI
NISL@THU
NISL@THU
I
Intezer
G
GRAHAM CLULEY
B
Blog
S
Secure Thoughts
IT之家
IT之家
宝玉的分享
宝玉的分享
Recent Announcements
Recent Announcements
Y
Y Combinator Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
酷 壳 – CoolShell
酷 壳 – CoolShell
有赞技术团队
有赞技术团队
V2EX - 技术
V2EX - 技术
Recorded Future
Recorded Future
Hacker News - Newest:
Hacker News - Newest: "LLM"

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

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(6) 读书笔记 UltraGrid(5) 读书笔记 UltraGrid(4) 读书笔记 UltraGrid(3)
读书笔记 UltraGrid(7)
木人(我现在不是老大) · 2012-02-11 · via 博客园 - 木人(我现在不是老大)

ultragrid的缺省编辑状态
允许删除和更新,不允许增加;
缺省删除,可以选择行,然后按【delete】键;
删除的提示信息,可通过下列方式修改:
ResourceCustomizer rc = Infragistics.Win.UltraWinGrid.Resources.Customizer;
rc.SetCustomizedString("DeleteMultipleRowsPrompt", "你选择删除{0}行!\n点击【是】则删除,否则点击【否】退出。");
rc.SetCustomizedString("DeleteRowsMessageTitle", "删除多行");
rc.SetCustomizedString("DeleteSingleRowMessageTitle", "删除行");
rc.SetCustomizedString("DeleteSingleRowPrompt", "你选择删除1行!\n点击【是】则删除,否则点击【否】退出。");

如何设置grid为只读呢?
可通过以下方式:
this.ultraGrid1.DisplayLayout.Override.AllowAddNew = AllowAddNew.No;
this.ultraGrid1.DisplayLayout.Override.AllowDelete = DefaultableBoolean.False;
this.ultraGrid1.DisplayLayout.Override.AllowUpdate = DefaultableBoolean.False;
第一句不是必须,因为缺省即如此。
这样设置后,grid就是不可以编辑的。不能用【delete】键删除。单元格也不能更新。
但还是可以通过程序来更新或者编辑的。如:
ultraGrid1.Rows[0].Delete(true);
ultraGrid1.Rows[0].Cells[0].Value = 1111;
这样设置后并不影响对文字的拷贝,可以选择部分文字来进行拷贝。这个非常重要!
同样的能达到的不能编辑的方式还有:
在ultraGrid1的InitializeRow事件中写:
e.Row.Activation = Activation.ActivateOnly;
这对band中的所有行都有效!似乎这样,如果行很多,效率是否有影响呢?

如何让grid根据显示的内容自适应宽度呢?
this.ultraGrid1.DisplayLayout.Override.AllowColSizing = AllowColSizing.Free;
foreach (UltraGridBand ugb in this.ultraGrid1.DisplayLayout.Bands)
   ugb.PerformAutoResizeColumns(false, PerformAutoSizeType.AllRowsInBand);
第一句让不同的band中的列宽可以不同。
许多时候使用
ugb.PerformAutoResizeColumns(false, PerformAutoSizeType.VisibleRows);好像计算不是那么准确的!