【发布时间】:2014-01-26 10:01:07
【问题描述】:
请问您能帮帮我吗?我在 winforms.designer.cs 中有所有按钮,并且我为所有按钮分配了相同的处理程序。处理程序是MouseEnter 和MouseLeave。我需要找到所有按钮并为每个按钮分配不同的MouseEnter 和MouseLeave。
我在一个按钮上试过这个,但它不起作用。
private void createButton_MouseEnter(object sender, EventArgs e)
{
createButton.Cursor = NativeMethods.LoadCustomCursor(Path.Combine(collection.source, collection.cursor_hand));
switch (Name)
{
case "createButton":
this.createButton.BackgroundImage = ((System.Drawing.Image)(Properties.Resources.create_on));
break;
}
}
【问题讨论】:
-
尽量清楚一点。你想分配什么?你有错误吗?
-
我没有任何错误。我想按名称搜索所有按钮。我加了一键切换,但他不叫。我不知道为什么。