Commit ebf3ac4d 冰封一夏 Gitee 提交于

!4 修正 UCDataGridView 的 ItemClick 事件 RowIndex 永远为 0

Merge pull request !4 from 熊本熊kumamon/master
2 个父辈 2847eef3 8c1159f1
...@@ -82,5 +82,10 @@ namespace HZH_Controls.Controls ...@@ -82,5 +82,10 @@ namespace HZH_Controls.Controls
/// </summary> /// </summary>
/// <value>The height of the row.</value> /// <value>The height of the row.</value>
int RowHeight { get; set; } int RowHeight { get; set; }
/// <summary>
/// 行号
/// </summary>
/// <value>The Index of the row.</value>
int RowIndex { get; set; }
} }
} }
...@@ -510,6 +510,7 @@ namespace HZH_Controls.Controls ...@@ -510,6 +510,7 @@ namespace HZH_Controls.Controls
item.BringToFront(); item.BringToFront();
Rows.Add(row); Rows.Add(row);
row.RowIndex = Rows.IndexOf(row);
} }
intIndex++; intIndex++;
} }
...@@ -533,8 +534,7 @@ namespace HZH_Controls.Controls ...@@ -533,8 +534,7 @@ namespace HZH_Controls.Controls
row.ReloadCells(); row.ReloadCells();
row.BindingCellData(); row.BindingCellData();
Control rowControl = (row as Control);
Control rowControl = (row as Control);
row.RowHeight = m_rowHeight; row.RowHeight = m_rowHeight;
rowControl.Dock = DockStyle.Top; rowControl.Dock = DockStyle.Top;
row.CellClick += (a, b) => { SetSelectRow(rowControl, b); }; row.CellClick += (a, b) => { SetSelectRow(rowControl, b); };
...@@ -542,6 +542,7 @@ namespace HZH_Controls.Controls ...@@ -542,6 +542,7 @@ namespace HZH_Controls.Controls
row.RowCustomEvent += (a, b) => { if (RowCustomEvent != null) { RowCustomEvent(a, b); } }; row.RowCustomEvent += (a, b) => { if (RowCustomEvent != null) { RowCustomEvent(a, b); } };
row.SourceChanged += RowSourceChanged; row.SourceChanged += RowSourceChanged;
Rows.Add(row); Rows.Add(row);
row.RowIndex = Rows.IndexOf(row);
this.panRow.Controls.Add(rowControl); this.panRow.Controls.Add(rowControl);
rowControl.BringToFront(); rowControl.BringToFront();
......
...@@ -75,6 +75,12 @@ namespace HZH_Controls.Controls ...@@ -75,6 +75,12 @@ namespace HZH_Controls.Controls
} }
/// <summary> /// <summary>
/// 行号
/// </summary>
/// <value>The Index of the row.</value>
public int RowIndex { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is show CheckBox. /// Gets or sets a value indicating whether this instance is show CheckBox.
/// </summary> /// </summary>
/// <value><c>true</c> if this instance is show CheckBox; otherwise, <c>false</c>.</value> /// <value><c>true</c> if this instance is show CheckBox; otherwise, <c>false</c>.</value>
...@@ -166,7 +172,7 @@ namespace HZH_Controls.Controls ...@@ -166,7 +172,7 @@ namespace HZH_Controls.Controls
} }
} }
} }
} }
} }
foreach (Control item in this.panCells.Controls) foreach (Control item in this.panCells.Controls)
{ {
...@@ -190,7 +196,8 @@ namespace HZH_Controls.Controls ...@@ -190,7 +196,8 @@ namespace HZH_Controls.Controls
CellClick(this, new DataGridViewEventArgs() CellClick(this, new DataGridViewEventArgs()
{ {
CellControl = this, CellControl = this,
CellIndex = (sender as Control).Tag.ToInt() CellIndex = (sender as Control).Tag.ToInt(),
RowIndex = this.RowIndex
}); });
} }
} }
...@@ -249,6 +256,7 @@ namespace HZH_Controls.Controls ...@@ -249,6 +256,7 @@ namespace HZH_Controls.Controls
{ {
CheckBoxChangeEvent(a, new DataGridViewEventArgs() CheckBoxChangeEvent(a, new DataGridViewEventArgs()
{ {
RowIndex = this.RowIndex,
CellControl = box, CellControl = box,
CellIndex = 0 CellIndex = 0
}); });
...@@ -277,9 +285,9 @@ namespace HZH_Controls.Controls ...@@ -277,9 +285,9 @@ namespace HZH_Controls.Controls
}; };
c = lbl; c = lbl;
} }
else else
{ {
Control cc = (Control)Activator.CreateInstance(item.CustomCellType); Control cc = (Control)Activator.CreateInstance(item.CustomCellType);
cc.Dock = DockStyle.Fill; cc.Dock = DockStyle.Fill;
c = cc; c = cc;
} }
......
...@@ -75,6 +75,12 @@ namespace HZH_Controls.Controls ...@@ -75,6 +75,12 @@ namespace HZH_Controls.Controls
} }
/// <summary> /// <summary>
/// 行号,树状图目前没有给予行号
/// </summary>
/// <value>The Index of the row.</value>
public int RowIndex { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is show CheckBox. /// Gets or sets a value indicating whether this instance is show CheckBox.
/// </summary> /// </summary>
/// <value><c>true</c> if this instance is show CheckBox; otherwise, <c>false</c>.</value> /// <value><c>true</c> if this instance is show CheckBox; otherwise, <c>false</c>.</value>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!