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

DrawToolBar() public method

public DrawToolBar ( Graphics dc, Rectangle clip_rectangle, System.Windows.Forms.ToolBar control ) : void
dc System.Drawing.Graphics
clip_rectangle System.Drawing.Rectangle
control System.Windows.Forms.ToolBar
return void
		public  override void DrawToolBar (Graphics dc, Rectangle clip_rectangle, ToolBar control) 
		{
			StringFormat format = new StringFormat ();
			format.Trimming = StringTrimming.EllipsisCharacter;
			format.LineAlignment = StringAlignment.Center;
			if (control.ShowKeyboardCuesInternal)
				format.HotkeyPrefix = HotkeyPrefix.Show;
			else
				format.HotkeyPrefix = HotkeyPrefix.Hide;

			if (control.TextAlign == ToolBarTextAlign.Underneath)
				format.Alignment = StringAlignment.Center;
			else
				format.Alignment = StringAlignment.Near;

			if (control.Appearance != ToolBarAppearance.Flat || control.Parent == null) {
				dc.FillRectangle (SystemBrushes.Control, clip_rectangle);
			}

			if (control.Divider && clip_rectangle.Y < 2) {
				if (clip_rectangle.Y < 1) {
					dc.DrawLine (SystemPens.ControlDark, clip_rectangle.X, 0, clip_rectangle.Right, 0);
				}
				dc.DrawLine (SystemPens.ControlLightLight, clip_rectangle.X, 1, clip_rectangle.Right, 1);
			}

			foreach (ToolBarItem item in control.items)
				if (item.Button.Visible && clip_rectangle.IntersectsWith (item.Rectangle))
					DrawToolBarButton (dc, control, item, format);

			format.Dispose ();
		}
ThemeWin32Classic