一个事件,两行代码,解决问题,通用方法!通过反射实现
//标签鼠标变手
private void lbl_MouseEnter(object sender, EventArgs e)
{
Type t = Type.GetType(sender.GetType().AssemblyQualifiedName);
t.GetProperty("Cursor").SetValue(sender, System.Windows.Forms.Cursors.Hand);
}
下面这个代码就只能适用于Lable控件了
//Lable标签鼠标变手
private void lbl_MouseEnter(object sender, EventArgs e)
{
Label lbl = sender as Label;
lbl.Cursor = Cursors.Hand;
}
我的博客地址:Wy博客