小编Rad*_*ant的帖子

如何预测winforms中的所有按钮(C#)

你能帮帮我吗?我在winforms.designer.cs中有所有按钮,我为所有按钮分配了相同的处理程序.处理程序是MouseEnterMouseLeave.我需要找到所有按钮和分配给每个不同的MouseEnterMouseLeave.

我在一个按钮上尝试了这个,但它不起作用.

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)

c# case button winforms

1
推荐指数
1
解决办法
6169
查看次数

标签 统计

button ×1

c# ×1

case ×1

winforms ×1