最近尝试使用自定义控件,创建一个usercontrol的自定义控件,在其中通过eventhandle创建一个自定义事件,我自己命名为focusedRowChanged,用来监听gridcontrol中数据变化,照着公司原来的例子创建完成以后,在新的窗体中直接拖拽过来使用,在新窗体的属性中也能看到这个事件,但是就是应用以后就是不走这个代码,哪位有经验的达人,指导一下,这个事件想要在新窗体中引用,还要做什么操作啊
调试欢乐多
{
public testCL()
{
InitializeComponent();
}
public event EventHandler focusRowChanged;
private void gridViewtt_focusRowChanged(object sender,DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
{
if (this.focusRowChanged != null)
{
this.focusRowChanged(this, EventArgs.Empty);
}
}
}应用控件窗体testchar.cs,在这里直接把上面的自定义控件拖进去了,而且在属性里面也看到了我自定义的事件,下面是代码
public partial class testchar : DevExpress.XtraEditors.XtraForm
{
public testchar()
{
InitializeComponent();
} private void testCL1_focusRowChanged(object sender, EventArgs e)
{
this.labelControl1.Text = "sdf ";
} private void testchar_Load(object sender, EventArgs e)
{ }
}还需要在哪里做设置,请指点