// 创建浏览栏目标题 void CreateBrowseColumns() { if (this.dpTable_items.Columns.Count > 1) { return; } List <string> columns = new List <string>() { "封面", "书名", "作者", "出版者", "出版日期" }; foreach (string s in columns) { DpColumn column = new DpColumn(); column.Text = s; column.Width = 120; this.dpTable_items.Columns.Add(column); } }
// 创建浏览栏目标题 void CreateBrowseColumns() { if (this.dpTable_browseLines.Columns.Count > 2) return; List<string> columns = new List<string>() { "封面", "书名", "作者", "出版者", "出版日期" }; foreach (string s in columns) { DpColumn column = new DpColumn(); column.Text = s; column.Width = 120; this.dpTable_browseLines.Columns.Add(column); } }
private void button_dpTable_fill_Click(object sender, EventArgs e) { if (this.dpTable1.Columns.Count == 0) { for (int i = 0; i < 10; i++) { DpColumn cell = new DpColumn(); cell.Text = "column " + i.ToString(); cell.Width = 100; this.dpTable1.Columns.Add(cell); } } string strImageFileName = Path.Combine(this.MainForm.DataDir, "ajax-loader.gif"); Image image = Image.FromFile(strImageFileName); for (int i = 0; i < 10; i++) { DpRow line = new DpRow(); line.ForeColor = System.Drawing.Color.Yellow; for (int j = 0; j < 10; j++) { DpCell cell = new DpCell(); if (j == 0) cell.Image = image; cell.Text = "asdf asd fa sdfa sdf asd fa sdf" + i.ToString() + " " + j.ToString(); if (j == 5) { cell.BackColor = System.Drawing.Color.Green; cell.ForeColor = System.Drawing.Color.White; cell.Font = new System.Drawing.Font(this.dpTable1.Font, FontStyle.Bold); } if (i == 2) cell.Alignment = DpTextAlignment.InheritLine; line.Add(cell); } if (i == 2) { line.BackColor = System.Drawing.Color.Red; line.Font = new System.Drawing.Font(this.dpTable1.Font, FontStyle.Italic); line.Alignment = StringAlignment.Center; } this.dpTable1.Rows.Add(line); } /* { DpRow line = new DpRow(); line.Style = DpRowStyle.Seperator; line.BackColor = Color.Blue; line.ForeColor = Color.White; this.dpTable1.Rows.Add(line); } * */ }