C# 修改GroupBox的邊框顏色和字體顏色


改變GroupBox邊框和的顏色

        private void groupBox_BasicInformation_Paint(object sender, PaintEventArgs e)
        {
            e.Graphics.Clear(this.groupBox_BasicInformation.BackColor);
            e.Graphics.DrawString(this.groupBox_BasicInformation.Text, this.groupBox_BasicInformation.Font, Brushes.Red, 10, 1);
            e.Graphics.DrawLine(Pens.Red, 1, 7, 8, 7);
            e.Graphics.DrawLine(Pens.Red, e.Graphics.MeasureString(this.groupBox_BasicInformation.Text, this.groupBox_BasicInformation.Font).Width + 8, 7, this.groupBox_BasicInformation.Width - 2, 7);
            e.Graphics.DrawLine(Pens.Red, 1, 7, 1, this.groupBox_BasicInformation.Height - 2);
            e.Graphics.DrawLine(Pens.Red, 1, this.groupBox_BasicInformation.Height - 2, this.groupBox_BasicInformation.Width - 2, this.groupBox_BasicInformation.Height - 2);
            e.Graphics.DrawLine(Pens.Red, this.groupBox_BasicInformation.Width - 2, 7, this.groupBox_BasicInformation.Width - 2, this.groupBox_BasicInformation.Height - 2); 
        }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM