【问题标题】:panel Border solid transparent effect c#面板边框实心透明效果c#
【发布时间】:2022-01-13 21:14:02
【问题描述】:

我想知道如何在 Winforms 上存档这种类型的边框面板效果,我已经使用 Fixed3d 选项获得了底线和右线,但顶部和左侧没有运气

【问题讨论】:

  • 边框有什么问题?看起来你有一个矩形。
  • 那不是我设计的,那是另一个软件的面板,我想做我的自定义面板,和图片中的一样,我试图达到与发布的图像相同的效果,但我没有得到预期的结果
  • 面板没有颜色边框,所以你可以在paint事件中绘制它。
  • 我已经知道了,我已经指定我要实现图片中矩形的效果

标签: c# winforms panel


【解决方案1】:

我已经在 OnPaint 事件中获得了此代码,如果有人正在寻找相同的感觉,可以查看此代码示例

private void panel1_Paint(object sender, PaintEventArgs e)
        {
            ControlPaint.DrawBorder(e.Graphics, panel1.ClientRectangle,
               Color.White, 2, ButtonBorderStyle.Solid,
               Color.White, 2, ButtonBorderStyle.Solid, 
               Color.FromArgb(100,160,160,160), 2, ButtonBorderStyle.Solid,
               Color.FromArgb(100, 160, 160, 160), 2 ButtonBorderStyle.Solid);

ControlPaint.DrawBorder(e.Graphics, panel1.ClientRectangle,
               Color.FromArgb(100, 160, 160, 160), 1, ButtonBorderStyle.Solid,
               Color.FromArgb(100, 160, 160, 160), 1, ButtonBorderStyle.Solid,
               Color.White, 1, ButtonBorderStyle.Solid,
               Color.White, 1, ButtonBorderStyle.Solid)
        }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-08-17
    • 1970-01-01
    • 2012-12-13
    • 2011-09-08
    • 2017-10-15
    • 2010-12-09
    相关资源
    最近更新 更多