14-11-12, 01:07 PM
14-11-12, 05:07 PM
وعليكم السلام
إستخدم الأمر التالي في حدث OnPoint للـ GroupBox
إستخدم الأمر التالي في حدث OnPoint للـ GroupBox
كود :
Dim tSize As Size = TextRenderer.MeasureText(GroupBox1.Text, GroupBox1.Font)
Dim borderRect As Rectangle = e.ClipRectangle
borderRect.Y = (borderRect.Y _
+ (tSize.Height / 2))
borderRect.Height = (borderRect.Height _
- (tSize.Height / 2))
ControlPaint.DrawBorder(e.Graphics, borderRect, Color.Blue, ButtonBorderStyle.Solid)
Dim textRect As Rectangle = e.ClipRectangle
textRect.X = (textRect.X + 6)
textRect.Width = tSize.Width
textRect.Height = tSize.Height
e.Graphics.FillRectangle(New SolidBrush(Me.BackColor), textRect)
e.Graphics.DrawString(GroupBox1.Text, GroupBox1.Font, New SolidBrush(GroupBox1.ForeColor), textRect)