【问题标题】:how to make an outer shadow for a custom Control如何为自定义控件制作外阴影
【发布时间】:2013-02-22 08:06:17
【问题描述】:

当鼠标移到我的控件上时,是否可以出现外部阴影?在winforms中?

我可以改变它的外观,但是一个影子?

public class MyButton : Button
{
    protected override void OnPaint(PaintEventArgs pevent)
    {
        GraphicsPath path = new GraphicsPath();
        path.AddEllipse(0, 0, ClientSize.Width, ClientSize.Height);
        this.Region = new Region(path);


        base.OnPaint(pevent);
    }
}

【问题讨论】:

    标签: c# winforms controls


    【解决方案1】:

    我是提问者。我可以在控件后面添加另一个标签,让它在鼠标悬停时显示为阴影。

    【讨论】:

      猜你喜欢
      • 2020-09-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-17
      • 1970-01-01
      相关资源
      最近更新 更多