System.Windows.Forms.ThemeWin32Classic.DrawGroupBox C# (CSharp) Method

DrawGroupBox() public method

public DrawGroupBox ( Graphics dc, Rectangle area, GroupBox box ) : void
dc System.Drawing.Graphics
area System.Drawing.Rectangle
box GroupBox
return void
		public override void DrawGroupBox (Graphics dc,  Rectangle area, GroupBox box) {
			StringFormat	text_format;
			SizeF		size;
			int		width;
			int		y;

			dc.FillRectangle (GetControlBackBrush (box.BackColor), box.ClientRectangle);
			
			text_format = new StringFormat();
			text_format.HotkeyPrefix = HotkeyPrefix.Show;

			size = dc.MeasureString (box.Text, box.Font);
			width = 0;

			if (size.Width > 0) {
				width = ((int) size.Width) + 7;
			
				if (width > box.Width - 16)
					width = box.Width - 16;
			}
			
			y = box.Font.Height / 2;

			// Clip the are that the text will be in
			Region prev_clip = dc.Clip;
			dc.SetClip (new Rectangle (10, 0, width, box.Font.Height), CombineMode.Exclude);
			/* Draw group box*/
			CPDrawBorder3D (dc, new Rectangle (0, y, box.Width, box.Height - y), Border3DStyle.Etched, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom, box.BackColor);
			dc.Clip = prev_clip;

			/* Text */
			if (box.Text.Length != 0) {
				if (box.Enabled) {
					dc.DrawString (box.Text, box.Font, ResPool.GetSolidBrush (box.ForeColor), 10, 0, text_format);
				} else {
					CPDrawStringDisabled (dc, box.Text, box.Font, box.BackColor, 
							      new RectangleF (10, 0, width,  box.Font.Height), text_format);
				}
			}
			
			text_format.Dispose ();	
		}
ThemeWin32Classic