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

推荐订阅源

SecWiki News
SecWiki News
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Visual Studio Blog
博客园 - 叶小钗
S
SegmentFault 最新的问题
IT之家
IT之家
大猫的无限游戏
大猫的无限游戏
博客园_首页
Apple Machine Learning Research
Apple Machine Learning Research
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
腾讯CDC
D
Darknet – Hacking Tools, Hacker News & Cyber Security
V
V2EX
阮一峰的网络日志
阮一峰的网络日志
L
Lohrmann on Cybersecurity
量子位
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tor Project blog
J
Java Code Geeks
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
博客园 - 三生石上(FineUI控件)
Attack and Defense Labs
Attack and Defense Labs
AI
AI
The Cloudflare Blog
T
Tailwind CSS Blog
S
Schneier on Security
爱范儿
爱范儿
PCI Perspectives
PCI Perspectives
Stack Overflow Blog
Stack Overflow Blog
S
Secure Thoughts
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
T
The Exploit Database - CXSecurity.com
博客园 - 【当耐特】
V2EX - 技术
V2EX - 技术
S
Securelist
P
Proofpoint News Feed
T
Threat Research - Cisco Blogs
Help Net Security
Help Net Security
C
Cisco Blogs
N
News and Events Feed by Topic
人人都是产品经理
人人都是产品经理
B
Blog RSS Feed
K
Kaspersky official blog
T
The Blog of Author Tim Ferriss
G
Google Developers Blog
S
Security Affairs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Simon Willison's Weblog
Simon Willison's Weblog

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

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);好像计算不是那么准确的!