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

DataGridPaintCaption() public method

public DataGridPaintCaption ( Graphics g, Rectangle clip, System.Windows.Forms.DataGrid grid ) : void
g System.Drawing.Graphics
clip System.Drawing.Rectangle
grid System.Windows.Forms.DataGrid
return void
		public override void DataGridPaintCaption (Graphics g, Rectangle clip, DataGrid grid)
		{
			Rectangle bounds = clip;
			bounds.Intersect (grid.caption_area);

			// Background
			g.FillRectangle (ResPool.GetSolidBrush (grid.CaptionBackColor), bounds);

			// Bottom line
    		g.DrawLine (ResPool.GetPen (grid.CurrentTableStyle.CurrentHeaderForeColor),
					bounds.X, bounds.Y + bounds.Height -1, 
                    bounds.X + bounds.Width, bounds.Y + bounds.Height -1);

			// Caption text
			if (grid.CaptionText != String.Empty) {
				Rectangle text_rect = grid.caption_area;
				text_rect.Y += text_rect.Height / 2 - grid.CaptionFont.Height / 2;
				text_rect.Height = grid.CaptionFont.Height;

				g.DrawString (grid.CaptionText, grid.CaptionFont,
					      ResPool.GetSolidBrush (grid.CaptionForeColor),
					      text_rect);
			}

			// Back button
			if (bounds.IntersectsWith (grid.back_button_rect)) {
				g.DrawImage (grid.back_button_image, grid.back_button_rect);
				if (grid.back_button_mouseover) {
					CPDrawBorder3D (g, grid.back_button_rect, grid.back_button_active ? Border3DStyle.Sunken : Border3DStyle.Raised, all_sides);
				}
			}

			// Rows button
			if (bounds.IntersectsWith (grid.parent_rows_button_rect)) {
				g.DrawImage (grid.parent_rows_button_image, grid.parent_rows_button_rect);
				if (grid.parent_rows_button_mouseover) {
					CPDrawBorder3D (g, grid.parent_rows_button_rect, grid.parent_rows_button_active ? Border3DStyle.Sunken : Border3DStyle.Raised, all_sides);
				}
			}
		}
ThemeWin32Classic