Commit f27f1d76 HZH

add DataGridView RowCustomEvent

1 个父辈 2d9497ce
...@@ -17,6 +17,5 @@ namespace HZH_Controls.Controls ...@@ -17,6 +17,5 @@ namespace HZH_Controls.Controls
public int CellIndex { get; set; } public int CellIndex { get; set; }
public int RowIndex { get; set; } public int RowIndex { get; set; }
} }
} }
...@@ -14,4 +14,8 @@ namespace HZH_Controls.Controls ...@@ -14,4 +14,8 @@ namespace HZH_Controls.Controls
[Serializable] [Serializable]
[ComVisible(true)] [ComVisible(true)]
public delegate void DataGridViewEventHandler(object sender, DataGridViewEventArgs e); public delegate void DataGridViewEventHandler(object sender, DataGridViewEventArgs e);
[Serializable]
[ComVisible(true)]
public delegate void DataGridViewRowCustomEventHandler(object sender, DataGridViewRowCustomEventArgs e);
} }
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace HZH_Controls.Controls
{
public class DataGridViewRowCustomEventArgs : EventArgs
{
public string EventName { get; set; }
}
}
...@@ -13,6 +13,7 @@ namespace HZH_Controls.Controls ...@@ -13,6 +13,7 @@ namespace HZH_Controls.Controls
{ {
public interface IDataGridViewRow public interface IDataGridViewRow
{ {
event DataGridViewRowCustomEventHandler RowCustomEvent;
/// <summary> /// <summary>
/// CheckBox选中事件 /// CheckBox选中事件
/// </summary> /// </summary>
......
...@@ -309,6 +309,8 @@ namespace HZH_Controls.Controls ...@@ -309,6 +309,8 @@ namespace HZH_Controls.Controls
public event DataGridViewEventHandler ItemClick; public event DataGridViewEventHandler ItemClick;
[Description("数据源改变事件"), Category("自定义")] [Description("数据源改变事件"), Category("自定义")]
public event DataGridViewEventHandler SourceChanged; public event DataGridViewEventHandler SourceChanged;
[Description("预留的自定义的事件,比如你需要在行上放置删改等按钮时,可以通过此事件传递出来"), Category("自定义")]
public event DataGridViewRowCustomEventHandler RowCustomEvent;
#endregion #endregion
#endregion #endregion
...@@ -505,6 +507,7 @@ namespace HZH_Controls.Controls ...@@ -505,6 +507,7 @@ namespace HZH_Controls.Controls
rowControl.Dock = DockStyle.Top; rowControl.Dock = DockStyle.Top;
row.CellClick += (a, b) => { SetSelectRow((Control)a, b); }; row.CellClick += (a, b) => { SetSelectRow((Control)a, b); };
row.CheckBoxChangeEvent += (a, b) => { SetSelectRow(rowControl, b); }; row.CheckBoxChangeEvent += (a, b) => { SetSelectRow(rowControl, b); };
row.RowCustomEvent += (a, b) => { if (RowCustomEvent != null) { RowCustomEvent(a, b); } };
row.SourceChanged += RowSourceChanged; row.SourceChanged += RowSourceChanged;
rowControl.BringToFront(); rowControl.BringToFront();
Rows.Add(row); Rows.Add(row);
......
...@@ -20,7 +20,7 @@ namespace HZH_Controls.Controls ...@@ -20,7 +20,7 @@ namespace HZH_Controls.Controls
#region 属性 #region 属性
public event DataGridViewEventHandler CheckBoxChangeEvent; public event DataGridViewEventHandler CheckBoxChangeEvent;
public event DataGridViewRowCustomEventHandler RowCustomEvent;
public event DataGridViewEventHandler CellClick; public event DataGridViewEventHandler CellClick;
public event DataGridViewEventHandler SourceChanged; public event DataGridViewEventHandler SourceChanged;
......
...@@ -19,7 +19,7 @@ namespace HZH_Controls.Controls ...@@ -19,7 +19,7 @@ namespace HZH_Controls.Controls
public event DataGridViewEventHandler CellClick; public event DataGridViewEventHandler CellClick;
public event DataGridViewEventHandler SourceChanged; public event DataGridViewEventHandler SourceChanged;
public event DataGridViewRowCustomEventHandler RowCustomEvent;
public List<DataGridViewColumnEntity> Columns public List<DataGridViewColumnEntity> Columns
{ {
get; get;
......
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
<Compile Include="Controls\DataGridView\DataGridViewCellEventArgs.cs" /> <Compile Include="Controls\DataGridView\DataGridViewCellEventArgs.cs" />
<Compile Include="Controls\DataGridView\DataGridViewCellEventHandler.cs" /> <Compile Include="Controls\DataGridView\DataGridViewCellEventHandler.cs" />
<Compile Include="Controls\DataGridView\DataGridViewColumnEntity.cs" /> <Compile Include="Controls\DataGridView\DataGridViewColumnEntity.cs" />
<Compile Include="Controls\DataGridView\DataGridViewRowCustomEventArgs.cs" />
<Compile Include="Controls\DataGridView\IDataGridViewRow.cs" /> <Compile Include="Controls\DataGridView\IDataGridViewRow.cs" />
<Compile Include="Controls\DataGridView\UCDataGridView.cs"> <Compile Include="Controls\DataGridView\UCDataGridView.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
......
...@@ -939,7 +939,7 @@ ...@@ -939,7 +939,7 @@
this.ucBtnFillet1.BtnImage = ((System.Drawing.Image)(resources.GetObject("ucBtnFillet1.BtnImage"))); this.ucBtnFillet1.BtnImage = ((System.Drawing.Image)(resources.GetObject("ucBtnFillet1.BtnImage")));
this.ucBtnFillet1.BtnText = "按钮3 "; this.ucBtnFillet1.BtnText = "按钮3 ";
this.ucBtnFillet1.ConerRadius = 10; this.ucBtnFillet1.ConerRadius = 10;
this.ucBtnFillet1.FillColor = System.Drawing.Color.Blue; this.ucBtnFillet1.FillColor = System.Drawing.Color.White;
this.ucBtnFillet1.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); this.ucBtnFillet1.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.ucBtnFillet1.ForeColor = System.Drawing.Color.White; this.ucBtnFillet1.ForeColor = System.Drawing.Color.White;
this.ucBtnFillet1.IsRadius = true; this.ucBtnFillet1.IsRadius = true;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!