zoukankan      html  css  js  c++  java
  • WinForm GroupBox控件重绘外观

    private void groupBoxFun_Paint(PaintEventArgs e, GroupBox groupBox)
    {

    e.Graphics.Clear(groupBox.BackColor);
    e.Graphics.DrawString(groupBox.Text, groupBox.Font, Brushes.Blue, 10, 1);
    e.Graphics.DrawLine(Pens.CornflowerBlue, 1, 7, 8, 7);
    e.Graphics.DrawLine(Pens.CornflowerBlue, e.Graphics.MeasureString(groupBox.Text, groupBox.Font).Width + 8 + 2, 7, groupBox.Width - 2, 7);

    e.Graphics.DrawLine(Pens.CornflowerBlue, 1, 7, 1, groupBox.Height - 2);
    e.Graphics.DrawLine(Pens.CornflowerBlue, 1, groupBox.Height - 2, groupBox.Width - 2, groupBox.Height - 2);
    e.Graphics.DrawLine(Pens.CornflowerBlue, groupBox.Width - 2, 7, groupBox.Width - 2, groupBox.Height - 2);
    }

    GroupBox控件的Paint事件中调用:

    private void groupBox1_Paint(object sender, PaintEventArgs e)
    {
    groupBoxFun_Paint(e, groupBox1);
    }

  • 相关阅读:
    Oracle第一课
    Web前端试题
    E
    Kingdom of Black and White
    D. Let's Go Hiking
    2021牛客寒假 第一场
    Codeforces Round #691 (Div. 2)
    CF1461D
    CF1461B
    浙财16th校赛 F因子
  • 原文地址:https://www.cnblogs.com/xifengyeluo/p/6410001.html
Copyright © 2011-2022 走看看