你能帮帮我吗?我在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;
}
}
Run Code Online (Sandbox Code Playgroud)