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

推荐订阅源

T
Threat Research - Cisco Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
V
Vulnerabilities – Threatpost
GbyAI
GbyAI
P
Proofpoint News Feed
L
LINUX DO - 热门话题
P
Palo Alto Networks Blog
A
About on SuperTechFans
T
Tenable Blog
M
MIT News - Artificial intelligence
IT之家
IT之家
I
Intezer
D
DataBreaches.Net
爱范儿
爱范儿
T
Threatpost
C
CERT Recently Published Vulnerability Notes
云风的 BLOG
云风的 BLOG
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
K
Kaspersky official blog
大猫的无限游戏
大猫的无限游戏
A
Arctic Wolf
Y
Y Combinator Blog
Cyberwarzone
Cyberwarzone
酷 壳 – CoolShell
酷 壳 – CoolShell
D
Darknet – Hacking Tools, Hacker News & Cyber Security
H
Help Net Security
Microsoft Security Blog
Microsoft Security Blog
Spread Privacy
Spread Privacy
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
AWS News Blog
AWS News Blog
博客园 - 聂微东
C
Check Point Blog
S
Securelist
有赞技术团队
有赞技术团队
雷峰网
雷峰网
aimingoo的专栏
aimingoo的专栏
Last Week in AI
Last Week in AI
Stack Overflow Blog
Stack Overflow Blog
MongoDB | Blog
MongoDB | Blog
D
Docker
G
GRAHAM CLULEY
T
The Exploit Database - CXSecurity.com
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tailwind CSS Blog
L
Lohrmann on Cybersecurity
G
Google Developers Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LangChain Blog

博客园 - Leo.Zhu

访问google的方法 Postgresql 迁移随笔一 英语词根6 英语词根3 英语词根4 英语词根2 英语词根 1 压力测试工具(Apache) “诸葛马前课-小六壬”全面解析 QT 中中文问题 - Leo.Zhu - 博客园 Ubuntu 尝试 C# 开发Activex ListView + ToolTip 的問題 JQueuy 使用记录---FileTree - Leo.Zhu - 博客园 Signals and Slots MS Ajax 客户端编程 学习笔记 (3) MS Ajax 客户端编程 学习笔记 (2) MS Ajax 客户端编程 学习笔记 (1) Englive.cn 英语 学习 在线背单词 - 语句本
dataGrid 使用记录 - Leo.Zhu - 博客园
Leo.Zhu · 2009-07-28 · via 博客园 - Leo.Zhu

DataGrid绑定Dataset,设定cell控件。

设定隐藏的栏位:

设定DataSet的Table对应的栏位为Hidden,绑定后DataGrid上不显示该栏位:

Depds.Tables["DepartMent1"].Columns["Pkey"].ColumnMapping = MappingType.Hidden;

设定DataGrid的样式:

               DataGridTableStyle dgdtblStyle = new DataGridTableStyle();
               dgdtblStyle.MappingName = this.Depds.Tables["XX"].TableName;
               if (dataGrid1.TableStyles.Contains("XX"))
                   dataGrid1.TableStyles.RemoveAt(0);

添加样式
               dataGrid1.TableStyles.Add(dgdtblStyle);
               dgdtblStyle.RowHeadersVisible = false;
               //dgdtblStyle.HeaderBackColor = Color.LightSteelBlue;           
               dgdtblStyle.AllowSorting = false;
               //dgdtblStyle.HeaderBackColor = Color.FromArgb(8,36,107);
               // dgdtblStyle.HeaderBackColor = Color.DarkGray;
               dgdtblStyle.RowHeadersVisible = true;
               dgdtblStyle.HeaderForeColor = Color.Black;

设定字体:
               dgdtblStyle.HeaderFont = new System.Drawing.Font("Microsoft Sans Serif", 9F,
               System.Drawing.FontStyle.Bold,
               System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
               //dgdtblStyle.GridLineColor = Color.DarkGray;

设定显示的高度:
               dgdtblStyle.PreferredRowHeight = 20;
               //dataGrid1.BackgroundColor = Color.White;               
               GridColumnStylesCollection colStyle = dataGrid1.TableStyles[0].GridColumnStyles;

设定显示的栏位名称:
                   colStyle[0].HeaderText = "a";
                   colStyle[1].HeaderText = "b";
                   colStyle[2].HeaderText = "c";
                   colStyle[3].HeaderText = "d";
                   colStyle[4].HeaderText = "e";
                   colStyle[5].HeaderText = "f";

//设置其下的dropbox  CreateDropBox会创建一个DropBox控件。
                DataGridTextBoxColumn f1 = (DataGridTextBoxColumn)dataGrid1.TableStyles[0].GridColumnStyles[1];
                f1.TextBox.Controls.Add(CreateDropBox());
                DataGridTextBoxColumn f2 = (DataGridTextBoxColumn)dataGrid1.TableStyles[0].GridColumnStyles[2];
                f2.TextBox.Controls.Add(CreateDropBox());
                DataGridTextBoxColumn f3 = (DataGridTextBoxColumn)dataGrid1.TableStyles[0].GridColumnStyles[3];
                f3.TextBox.Controls.Add(CreateDropBox());
                DataGridTextBoxColumn f4 = (DataGridTextBoxColumn)dataGrid1.TableStyles[0].GridColumnStyles[4];
                f4.TextBox.Controls.Add(CreateDropBox());
                DataGridTextBoxColumn f5 = (DataGridTextBoxColumn)dataGrid1.TableStyles[0].GridColumnStyles[5];
                f5.Format = "yyyy/MM/dd HH:ss:mm";

public ComboBox CreateDropBox()
      {
          try
          {
              ComboBox cmbFunctionArea = new ComboBox();

              cmbFunctionArea.Items.AddRange(Floorlist.ToArray());
              cmbFunctionArea.Cursor = Cursors.Arrow;
              cmbFunctionArea.DropDownStyle = ComboBoxStyle.DropDownList;
              cmbFunctionArea.Dock = DockStyle.Fill;
              cmbFunctionArea.SelectedIndex = 0;
              cmbFunctionArea.SelectionChangeCommitted += new EventHandler(cmbFunctionArea_SelectionChangeCommitted);
              return cmbFunctionArea;
          }
          catch (System.Exception exp)
          {
          }
          return null;
      }

收…………