zoukankan      html  css  js  c++  java
  • c# groupBox 带标题边框,标题居中,重写控件

    private void groupBox1_Paint(object sender, PaintEventArgs e)
    {
    //背景颜色
    e.Graphics.Clear(System.Drawing.SystemColors.Control);
    SizeF fontSize = e.Graphics.MeasureString(groupBox1.Text, groupBox1.Font); //背景颜色
    e.Graphics.DrawString(groupBox1.Text, groupBox1.Font, Brushes.Black, (groupBox1.Width - fontSize.Width) / 2, 1); e.Graphics.DrawLine(Pens.CornflowerBlue, 1, 7, (groupBox1.Width - fontSize.Width) / 2, 7); e.Graphics.DrawLine(Pens.CornflowerBlue, (groupBox1.Width + fontSize.Width) / 2 - 4, 7, groupBox1.Width - 2, 7); e.Graphics.DrawLine(Pens.CornflowerBlue, 1, 7, 1, groupBox1.Height - 2); e.Graphics.DrawLine(Pens.CornflowerBlue, 1, groupBox1.Height - 2, groupBox1.Width - 2, groupBox1.Height - 2); e.Graphics.DrawLine(Pens.CornflowerBlue, groupBox1.Width - 2, 7, groupBox1.Width - 2, groupBox1.Height - 2);
     
     
    e.Graphics.DrawLine(Pens.CornflowerBlue, 1, 7, 1, groupBox1.Height - 2);
  • 相关阅读:
    30-JDBC(2)
    29-JDBC(1)
    27-网络编程
    26-IO(中)
    git push 报错
    IsEmpty和isBlank区别
    java.lang.NumberFormatException: For input string: "0.9"
    Integer与Double类型转换
    Lambda 表达式排序
    Number & Math 类方法
  • 原文地址:https://www.cnblogs.com/RCJL/p/12145877.html
Copyright © 2011-2022 走看看