admin 管理员组文章数量: 887021
2023年12月22日发(作者:linux系统安装conda)
29 { 30 get; 31 set; 32 } 33
34 public object DataSource 35 { 36 get; 37 set; 38 } 39
40 public bool IsShowCheckBox 41 { 42 get; 43 set; 44 } 45 private bool m_isChecked; 46 public bool IsChecked 47 { 48 get 49 { 50 return m_isChecked; 51 } 52
53 set 54 { 55 if (m_isChecked != value) 56 { 57 m_isChecked = value; 58 (("check", false)[0] as UCCheckBox).Checked = value; 59 } 60 } 61 } 62
63
64 #endregion 65
66 public UCDataGridViewRow() 67 { 68 InitializeComponent(); 69 } 70
71 public void BindingCellData() 72 { 73 for (int i = 0; i < ; i++) 74 { 75 DataGridViewColumnEntity com = Columns[i]; 76 var cs = ("lbl_" + eld, false); 77 if (cs != null && > 0) 78 { 79 var pro = e().GetProperty(eld); 80 if (pro != null) 81 { 82 var value = ue(DataSource, null); 83 if ( != null) 84 { 85 cs[0].Text = (value); 86 } 87 else 88 { 89 cs[0].Text = ngExt(); 90 } 91 } 92 } 93 } 94 } 95
96 void Item_MouseDown(object sender, MouseEventArgs e) 97 { 98 if (CellClick != null) 99 {100 CellClick(sender, new DataGridViewEventArgs()101 {102 CellControl = this,103 CellIndex = (sender as Control).()104 });105 }106 }107
108 public void SetSelect(bool blnSelected)109 {110 if (blnSelected)111 {112 lor = gb(255, 247, 245);113 }114 else115 {116 lor = arent;117 }118 }119
120 public void ReloadCells()121 {122 try123 {124 Control(this, true);125 ();126 ();127
128 int intColumnsCount = ();129 if (Columns != null && intColumnsCount > 0)130 {131 if (IsShowCheckBox)132 {133 intColumnsCount++;134 }135 Count = intColumnsCount;136 for (int i = 0; i < intColumnsCount; i++)
1 #region 公共函数 2 ///
14 Control(, true); 15 (); 16 Rows = new List
22 int intSourceCount = 0; 23 if (m_dataSource is DataTable) 24 { 25 intSourceCount = (m_dataSource as DataTable).; 26 } 27 else if (typeof(IList).IsAssignableFrom(m_e())) 28 { 29 intSourceCount = (m_dataSource as IList).Count; 30 } 31
32 foreach (Control item in ls) 33 { 34
35
36 if (intIndex >= intSourceCount) 37 { 38 e = false; 39 } 40 else 41 { 42 var row = (item as IDataGridViewRow); 43 CheckBox = m_isShowCheckBox; 44 if (m_dataSource is DataTable) 45 { 46 urce = (m_dataSource as DataTable).Rows[intIndex]; 47 } 48 else 49 { 50 urce = (m_dataSource as IList)[intIndex]; 51 } 52 gCellData(); 53 = m_rowHeight; 54 e = true; 55 oFront(); 56 if (lastItem == null) 57 lastItem = item; 58 (row); 59 } 60 intIndex++; 61 } 62
63 if (intIndex < intSourceCount) 64 { 65 for (int i = intIndex; i < intSourceCount; i++) 66 { 67 IDataGridViewRow row = (IDataGridViewRow)Instance(m_rowType); 68 if (m_dataSource is DataTable) 69 { 70 urce = (m_dataSource as DataTable).Rows[i]; 71 } 72 else 73 { 74 urce = (m_dataSource as IList)[i]; 75 } 76 s = m_columns; 77 List
82
83 Control rowControl = (row as Control); 84 = m_rowHeight; 85 (rowControl); 86 = ; 87 ick += (a, b) => { SetSelectRow(rowControl, b); }; 88 oxChangeEvent += (a, b) => { SetSelectRow(rowControl, b); }; 89 Changed += RowSourceChanged; 90 oFront(); 91 (row); 92
93 if (lastItem == null) 94 lastItem = rowControl; 95 } 96 } 97 if (lastItem != null && intSourceCount == m_showCount) 98 { 99 = - (m_showCount - 1) * m_rowHeight;100 }101 }102 }103 finally104 {105 Control(, false);106 }107 }108
346 /// 任务编号:POS347 /// 348 ///
359 #region 公共函数360 ///
372 Control(, true);373 ();374 Rows = new List
380 int intSourceCount = 0;381 if (m_dataSource is DataTable)382 {383 intSourceCount = (m_dataSource as DataTable).;384 }385 else if (typeof(IList).IsAssignableFrom(m_e()))386 {387 intSourceCount = (m_dataSource as IList).Count;388 }389
390 foreach (Control item in ls)391 {392
393
394 if (intIndex >= intSourceCount)395 {396 e = false;397 }398 else399 {400 var row = (item as IDataGridViewRow);401 CheckBox = m_isShowCheckBox;402 if (m_dataSource is DataTable)403 {404 urce = (m_dataSource as DataTable).Rows[intIndex];405 }406 else407 {408 urce = (m_dataSource as IList)[intIndex];409 }410 gCellData();411 = m_rowHeight;412 e = true;413 oFront();414 if (lastItem == null)415 lastItem = item;416 (row);417 }418 intIndex++;419 }420
421 if (intIndex < intSourceCount)422 {423 for (int i = intIndex; i < intSourceCount; i++)424 {425 IDataGridViewRow row = (IDataGridViewRow)Instance(m_rowType);426 if (m_dataSource is DataTable)427 {428 urce = (m_dataSource as DataTable).Rows[i];429 }430 else431 {432 urce = (m_dataSource as IList)[i];433 }434 s = m_columns;435 List
440
441 Control rowControl = (row as Control);442 = m_rowHeight;443 (rowControl);444 = ;445 ick += (a, b) => { SetSelectRow(rowControl, b); };446 oxChangeEvent += (a, b) => { SetSelectRow(rowControl, b); };447 Changed += RowSourceChanged;448 oFront();449 (row);450
451 if (lastItem == null)452 lastItem = rowControl;453 }
版权声明:本文标题:(三十二)c#Winform自定义控件-表格-HZHControls 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.freenas.com.cn/jishu/1703214205h442525.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论