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

推荐订阅源

T
Threatpost
The Hacker News
The Hacker News
AWS News Blog
AWS News Blog
Spread Privacy
Spread Privacy
T
Tenable Blog
C
CERT Recently Published Vulnerability Notes
Cisco Talos Blog
Cisco Talos Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
S
Securelist
P
Privacy & Cybersecurity Law Blog
Know Your Adversary
Know Your Adversary
T
The Exploit Database - CXSecurity.com
Latest news
Latest news
D
Darknet – Hacking Tools, Hacker News & Cyber Security
I
Intezer
F
Fortinet All Blogs
Engineering at Meta
Engineering at Meta
Simon Willison's Weblog
Simon Willison's Weblog
The Register - Security
The Register - Security
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
L
Lohrmann on Cybersecurity
C
Cyber Attacks, Cyber Crime and Cyber Security
Microsoft Azure Blog
Microsoft Azure Blog
P
Proofpoint News Feed
H
Help Net Security
T
Threat Research - Cisco Blogs
D
DataBreaches.Net
S
Schneier on Security
Cyberwarzone
Cyberwarzone
Google DeepMind News
Google DeepMind News
P
Privacy International News Feed
S
Secure Thoughts
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Recorded Future
Recorded Future
C
Cybersecurity and Infrastructure Security Agency CISA
MyScale Blog
MyScale Blog
M
MIT News - Artificial intelligence
Stack Overflow Blog
Stack Overflow Blog
IT之家
IT之家
人人都是产品经理
人人都是产品经理
NISL@THU
NISL@THU
博客园 - Franky
T
Tor Project blog
G
GRAHAM CLULEY
博客园 - 【当耐特】
Jina AI
Jina AI
Security Archives - TechRepublic
Security Archives - TechRepublic
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
A
About on SuperTechFans
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(7) 读书笔记 UltraGrid(6) 读书笔记 UltraGrid(5) 读书笔记 UltraGrid(4) 读书笔记 UltraGrid(3)
读书笔记 UltraGrid(8)
木人(我现在不是老大) · 2012-02-11 · via 博客园 - 木人(我现在不是老大)

设置某一列为只读
this.ultraGrid1.DisplayLayout.Bands[0].Columns[0].CellActivation = Activation.ActivateOnly;

选择后的缺省前景和背景色
this.ultraGrid1.DisplayLayout.DefaultSelectedBackColor = Color.Azure;
this.ultraGrid1.DisplayLayout.DefaultSelectedForeColor = Color.YellowGreen;

使用dataset绑定。
检索数据,建立table之间的关系。ultraGrid自动建立层次式展示方式。
DataSet data = new DataSet();
SqlDataAdapter da = new SqlDataAdapter("select * from customers", cnnstring);
da.Fill(data, "Customers");
da = new SqlDataAdapter("select * from pdctorders", cnnstring);
da.Fill(data, "PdctOrders");
DataRelation mydr = new DataRelation("Customers_PdctOrders", data.Tables["Customers"].Columns["CustID"], data.Tables["pdctorders"].Columns["CustID"], false);
data.Relations.Add(mydr);

da = new SqlDataAdapter("select * from SaleContracts", cnnstring);
da.Fill(data, "SaleContracts");
DataRelation mydr2 = new DataRelation("Customers_SaleContracts", data.Tables["Customers"].Columns["CustID"], data.Tables["SaleContracts"].Columns["CustID"],

false);
data.Relations.Add(mydr2);

this.ultraGrid1.DataSource = data;
1)系统自动根据源数据的类型选择合适的控件展示,如日历控件、单选框等;
2)缺省都是左对齐的;
3)所有数据原样显示,没有格式化的。

如何根据数据类型自动设置列,如格式、对齐等?
            foreach (UltraGridBand ugb in this.ultraGrid1.DisplayLayout.Bands)
            {
                foreach (UltraGridColumn ugc in ugb.Columns)
                {
                    if (ugc.DataType == Type.GetType("System.Int8") ||
                        ugc.DataType == Type.GetType("System.Int16") ||
                        ugc.DataType == Type.GetType("System.Int32") ||
                        ugc.DataType == Type.GetType("System.Int64"))
                    {
                        ugc.Format = "#,#";
                        ugc.CellAppearance.TextHAlign = HAlign.Right;
                    }
                    else if (ugc.DataType == Type.GetType("System.Single") ||
                        ugc.DataType == Type.GetType("System.Double"))
                    {
                        ugc.Format = "#,0.00";
                        ugc.CellAppearance.TextHAlign = HAlign.Right;
                    }
                    else if (ugc.DataType == Type.GetType("System.DateTime"))
                    {
                        ugc.Format = "yyyy/MM/dd";
                        ugc.MaskInput = "yyyy/mm/dd";
                    }
                }
            }