* TabControl.cs: Show the tooltip depending on the value
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / ToolStripProfessionalRenderer.cs
1 //
2 // ToolStripProfessionalRenderer.cs
3 //
4 // Permission is hereby granted, free of charge, to any person obtaining
5 // a copy of this software and associated documentation files (the
6 // "Software"), to deal in the Software without restriction, including
7 // without limitation the rights to use, copy, modify, merge, publish,
8 // distribute, sublicense, and/or sell copies of the Software, and to
9 // permit persons to whom the Software is furnished to do so, subject to
10 // the following conditions:
11 // 
12 // The above copyright notice and this permission notice shall be
13 // included in all copies or substantial portions of the Software.
14 // 
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 //
23 // Copyright (c) 2006 Jonathan Pobst
24 //
25 // Authors:
26 //      Jonathan Pobst (monkey@jpobst.com)
27 //
28 #if NET_2_0
29
30 using System;
31 using System.Drawing;
32 using System.Drawing.Drawing2D;
33 using System.Drawing.Imaging;
34
35 namespace System.Windows.Forms
36 {
37         public class ToolStripProfessionalRenderer : ToolStripRenderer
38         {
39                 private ProfessionalColorTable color_table;
40                 private bool rounded_edges;
41
42                 #region Public Constructor
43                 public ToolStripProfessionalRenderer () : this (new ProfessionalColorTable ())
44                 {
45                 }
46                 
47                 public ToolStripProfessionalRenderer (ProfessionalColorTable professionalColorTable) : base ()
48                 {
49                         color_table = professionalColorTable;
50                         rounded_edges = true;
51                 }
52                 #endregion
53
54                 #region Public Properties
55                 public ProfessionalColorTable ColorTable {
56                         get { return this.color_table; }
57                 }
58
59                 public bool RoundedEdges {
60                         get { return this.rounded_edges; }
61                         set { this.rounded_edges = value; }
62                 }
63                 #endregion
64
65                 #region Protected Methods
66                 protected override void OnRenderArrow (ToolStripArrowRenderEventArgs e)
67                 {
68                         base.OnRenderArrow (e);
69                 }
70
71                 protected override void OnRenderButtonBackground (ToolStripItemRenderEventArgs e)
72                 {
73                         if (e.Item.Enabled == false)
74                                 return;
75                                 
76                         Rectangle paint_here = new Rectangle (0, 0, e.Item.Width, e.Item.Height);
77
78                         // Paint gradient background
79                         if (e.Item is ToolStripButton && (e.Item as ToolStripButton).Checked && !e.Item.Selected) {
80                                 if (this.ColorTable.UseSystemColors)
81                                         e.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (this.ColorTable.ButtonCheckedHighlight), paint_here);
82                                 else
83                                         using (Brush b = new LinearGradientBrush (paint_here, this.ColorTable.ButtonCheckedGradientBegin, this.ColorTable.ButtonCheckedGradientEnd, LinearGradientMode.Vertical))
84                                         e.Graphics.FillRectangle (b, paint_here); }
85                         else
86                                 if (e.Item is ToolStripDropDownItem && e.Item.Pressed) // || (e.Item as ToolStripMenuItem).DropDown.Visible == true))
87                                         using (Brush b = new LinearGradientBrush (paint_here, this.ColorTable.ToolStripGradientBegin, this.ColorTable.ToolStripGradientEnd, LinearGradientMode.Vertical))
88                                                 e.Graphics.FillRectangle (b, paint_here);
89                                 else if (e.Item.Pressed || (e.Item is ToolStripButton && (e.Item as ToolStripButton).Checked))
90                                         using (Brush b = new LinearGradientBrush (paint_here, this.ColorTable.ButtonPressedGradientBegin, this.ColorTable.ButtonPressedGradientEnd, LinearGradientMode.Vertical))
91                                                 e.Graphics.FillRectangle (b, paint_here);
92                                 else if (e.Item.Selected) // && !e.Item.Pressed)
93                                         using (Brush b = new LinearGradientBrush (paint_here, this.ColorTable.ButtonSelectedGradientBegin, this.ColorTable.ButtonSelectedGradientEnd, LinearGradientMode.Vertical))
94                                                 e.Graphics.FillRectangle (b, paint_here);
95                                 else if (e.Item.BackColor != Control.DefaultBackColor && e.Item.BackColor != Color.Empty)
96                                         using (Brush b = new SolidBrush (e.Item.BackColor))
97                                                 e.Graphics.FillRectangle (b, paint_here);
98
99                         paint_here.Width -= 1;
100                         paint_here.Height -= 1;
101
102                         // Paint border
103                         if (e.Item.Selected && !e.Item.Pressed)
104                                 using (Pen p = new Pen (this.ColorTable.ButtonSelectedBorder))
105                                         e.Graphics.DrawRectangle (p, paint_here);
106                         else if (e.Item.Pressed)
107                                 using (Pen p = new Pen (this.ColorTable.ButtonPressedBorder))
108                                         e.Graphics.DrawRectangle (p, paint_here);
109                         else if (e.Item is ToolStripButton && (e.Item as ToolStripButton).Checked)
110                                 using (Pen p = new Pen (this.ColorTable.ButtonPressedBorder))
111                                         e.Graphics.DrawRectangle (p, paint_here);
112
113                         base.OnRenderButtonBackground (e);
114                 }
115
116                 protected override void OnRenderDropDownButtonBackground (ToolStripItemRenderEventArgs e)
117                 {
118                         Rectangle paint_here = new Rectangle (0, 0, e.Item.Width, e.Item.Height);
119
120                         // Paint gradient background
121                         if (e.Item.Selected && !e.Item.Pressed)
122                                 using (Brush b = new LinearGradientBrush (paint_here, this.ColorTable.ButtonSelectedGradientBegin, this.ColorTable.ButtonSelectedGradientEnd, LinearGradientMode.Vertical))
123                                         e.Graphics.FillRectangle (b, paint_here);
124                         else if (e.Item.Pressed)
125                                 using (Brush b = new LinearGradientBrush (paint_here, this.ColorTable.ImageMarginGradientMiddle, this.ColorTable.ImageMarginGradientEnd, LinearGradientMode.Vertical))
126                                         e.Graphics.FillRectangle (b, paint_here);
127
128                         paint_here.Width -= 1;
129                         paint_here.Height -= 1;
130
131                         // Paint border
132                         if (e.Item.Selected && !e.Item.Pressed)
133                                 using (Pen p = new Pen (this.ColorTable.ButtonSelectedBorder))
134                                         e.Graphics.DrawRectangle (p, paint_here);
135                         else if (e.Item.Pressed)
136                                 using (Pen p = new Pen (this.ColorTable.MenuBorder))
137                                         e.Graphics.DrawRectangle (p, paint_here);
138
139                         base.OnRenderDropDownButtonBackground (e);
140                 }
141
142                 protected override void OnRenderGrip (ToolStripGripRenderEventArgs e)
143                 {
144                         if (e.GripStyle == ToolStripGripStyle.Hidden)
145                                 return;
146
147                         if (e.GripDisplayStyle == ToolStripGripDisplayStyle.Vertical) {
148                                 Rectangle r = new Rectangle (e.GripBounds.Left, e.GripBounds.Top + 5, 2, 2);
149
150                                 for (int i = 0; i < e.GripBounds.Height - 12; i += 4) {
151                                         e.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (this.ColorTable.GripLight), r);
152                                         r.Offset (0, 4);
153                         }
154
155                                 Rectangle r2 = new Rectangle (e.GripBounds.Left - 1, e.GripBounds.Top + 4, 2, 2);
156
157                                 for (int i = 0; i < e.GripBounds.Height - 12; i += 4) {
158                                         e.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (this.ColorTable.GripDark), r2);
159                                         r2.Offset (0, 4);
160                                 }
161                         }
162                         else {
163                                 Rectangle r = new Rectangle (e.GripBounds.Left + 5, e.GripBounds.Top, 2, 2);
164
165                                 for (int i = 0; i < e.GripBounds.Width - 11; i += 4) {
166                                         e.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (this.ColorTable.GripLight), r);
167                                         r.Offset (4, 0);
168                                 }
169
170                                 Rectangle r2 = new Rectangle (e.GripBounds.Left + 4, e.GripBounds.Top - 1, 2, 2);
171
172                                 for (int i = 0; i < e.GripBounds.Width - 11; i += 4) {
173                                         e.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (this.ColorTable.GripDark), r2);
174                                         r2.Offset (4, 0);
175                                 }
176                         }
177
178                         base.OnRenderGrip (e);
179                 }
180
181                 protected override void OnRenderImageMargin (ToolStripRenderEventArgs e)
182                 {
183                         if (!(e.ToolStrip is ToolStripOverflow)) {
184                                 Rectangle side_gradient = new Rectangle (1, 2, 24, e.ToolStrip.Height - 3);
185                                 using (LinearGradientBrush b = new LinearGradientBrush (side_gradient, this.ColorTable.ToolStripGradientBegin, this.ColorTable.ToolStripGradientEnd, LinearGradientMode.Horizontal))
186                                         e.Graphics.FillRectangle (b, side_gradient);
187                         }
188
189                         base.OnRenderImageMargin (e);
190                 }
191
192                 protected override void OnRenderItemCheck (ToolStripItemImageRenderEventArgs e)
193                 {
194                         if (e.Item.Selected)
195                         {
196                                 e.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (this.ColorTable.CheckPressedBackground), e.ImageRectangle);
197                                 e.Graphics.DrawRectangle (ThemeEngine.Current.ResPool.GetPen (this.ColorTable.ButtonPressedBorder), e.ImageRectangle);
198                         }
199                         else if (e.Item.Pressed)
200                         {
201                                 e.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (this.ColorTable.CheckSelectedBackground), e.ImageRectangle);
202                                 e.Graphics.DrawRectangle (ThemeEngine.Current.ResPool.GetPen (this.ColorTable.ButtonSelectedBorder), e.ImageRectangle);
203                         }
204                         else
205                         {
206                                 e.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (this.ColorTable.CheckSelectedBackground), e.ImageRectangle);
207                                 e.Graphics.DrawRectangle (ThemeEngine.Current.ResPool.GetPen (this.ColorTable.ButtonSelectedBorder), e.ImageRectangle);
208                         }
209                         if (e.Item.Image == null)
210                                 ControlPaint.DrawMenuGlyph(e.Graphics, new Rectangle (6,5,7,6), MenuGlyph.Checkmark);
211                         
212                         base.OnRenderItemCheck (e);
213                 }
214                 
215                 protected override void OnRenderItemImage (ToolStripItemImageRenderEventArgs e)
216                 {
217                         base.OnRenderItemImage (e);
218                 }
219
220                 protected override void OnRenderItemText (ToolStripItemTextRenderEventArgs e)
221                 {
222                         base.OnRenderItemText (e);
223                 }
224
225                 protected override void OnRenderLabelBackground (ToolStripItemRenderEventArgs e)
226                 {
227                         base.OnRenderLabelBackground (e);
228                 }
229
230                 protected override void OnRenderMenuItemBackground (ToolStripItemRenderEventArgs e)
231                 {
232                         ToolStripMenuItem tsmi = (ToolStripMenuItem)e.Item;
233                         Rectangle paint_here;
234
235                         if (tsmi.IsOnDropDown) {
236                                 paint_here = new Rectangle (1, 0, e.Item.Bounds.Width - 3, e.Item.Bounds.Height - 1);
237                                 
238                                 if (e.Item.Selected || e.Item.Pressed)
239                                         if (e.Item.Enabled)
240                                                 e.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (this.ColorTable.MenuItemSelectedGradientEnd), paint_here);
241
242                                 if (tsmi.Selected || tsmi.Pressed)
243                                         using (Pen p = new Pen (this.ColorTable.MenuItemBorder))
244                                                 e.Graphics.DrawRectangle (p, paint_here);
245                         }
246                         else {
247                                 paint_here = new Rectangle (0, 0, e.Item.Width, e.Item.Height);
248
249                                 if (e.Item.Pressed)
250                                         using (Brush b = new LinearGradientBrush (paint_here, this.ColorTable.ToolStripGradientBegin, this.ColorTable.ToolStripGradientEnd, LinearGradientMode.Vertical))
251                                                 e.Graphics.FillRectangle (b, paint_here);
252                                 else if (e.Item.Selected)
253                                         using (Brush b = new LinearGradientBrush (paint_here, this.ColorTable.ButtonSelectedGradientBegin, this.ColorTable.ButtonSelectedGradientEnd, LinearGradientMode.Vertical))
254                                                 e.Graphics.FillRectangle (b, paint_here);
255                                 else if (e.Item.BackColor != Control.DefaultBackColor && e.Item.BackColor != Color.Empty)
256                                         using (Brush b = new SolidBrush (e.Item.BackColor))
257                                                 e.Graphics.FillRectangle (b, paint_here);
258
259                                 paint_here.Width -= 1;
260                                 paint_here.Height -= 1;
261
262                                 if (tsmi.Selected || tsmi.Pressed) {
263                                         if (tsmi.HasDropDownItems && tsmi.DropDown.Visible)
264                                                 using (Pen p = new Pen (this.ColorTable.MenuBorder))
265                                                         e.Graphics.DrawRectangle (p, paint_here);                               
266                                         else
267                                                 using (Pen p = new Pen (this.ColorTable.MenuItemBorder))
268                                                         e.Graphics.DrawRectangle (p, paint_here);
269                                 }
270                         }
271                         
272                         base.OnRenderMenuItemBackground (e);
273                 }
274
275                 protected override void OnRenderOverflowButtonBackground (ToolStripItemRenderEventArgs e)
276                 {
277                         Rectangle paint_here;
278                         LinearGradientMode gradient_direction = e.ToolStrip.Orientation == Orientation.Vertical ? LinearGradientMode.Horizontal : LinearGradientMode.Vertical;
279                         
280                         if (e.ToolStrip.Orientation == Orientation.Horizontal)
281                                 paint_here = new Rectangle (e.Item.Width - 11, 0, 11, e.Item.Height - 1);
282                         else
283                                 paint_here = new Rectangle (0, e.Item.Height - 11, e.Item.Width - 1, 11);
284                         
285                         // Paint gradient background
286                         if (e.Item.Selected && !e.Item.Pressed)
287                                 using (Brush b = new LinearGradientBrush (paint_here, this.ColorTable.ButtonSelectedGradientBegin, this.ColorTable.ButtonSelectedGradientEnd, gradient_direction))
288                                         e.Graphics.FillRectangle (b, paint_here);
289                         else if (e.Item.Pressed)
290                                 using (Brush b = new LinearGradientBrush (paint_here, this.ColorTable.ButtonPressedGradientBegin, this.ColorTable.ButtonPressedGradientEnd, gradient_direction))
291                                         e.Graphics.FillRectangle (b, paint_here);
292                         else
293                                 using (Brush b = new LinearGradientBrush (paint_here, this.ColorTable.OverflowButtonGradientBegin, this.ColorTable.OverflowButtonGradientEnd, gradient_direction))
294                                         e.Graphics.FillRectangle (b, paint_here);
295
296                         // Paint the arrow
297                         PaintOverflowArrow (e, paint_here);
298
299                         base.OnRenderOverflowButtonBackground (e);
300                 }
301
302                 protected override void OnRenderSeparator (ToolStripSeparatorRenderEventArgs e)
303                 {
304                         if (e.Vertical) {
305                                 Rectangle r = new Rectangle (4, 6, 1, e.Item.Height - 10);
306                                 e.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (this.ColorTable.SeparatorLight), r);
307
308                                 Rectangle r2 = new Rectangle (3, 5, 1, e.Item.Height - 10);
309                                 e.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (this.ColorTable.SeparatorDark), r2);
310                         }
311                         else {
312                                 if (!e.Item.IsOnDropDown) {
313                                         Rectangle r = new Rectangle (6, 4, e.Item.Width - 10, 1);
314                                         e.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (this.ColorTable.SeparatorLight), r);
315                                 }
316
317                                 Rectangle r3;
318                                 if (e.Item.IsOnDropDown) {
319                                         if (e.Item.UseImageMargin)
320                                                 r3 = new Rectangle (35, 3, e.Item.Width - 36, 1);
321                                         else
322                                                 r3 = new Rectangle (7, 3, e.Item.Width - 7, 1);
323                                 } else
324                                         r3 = new Rectangle (5, 3, e.Item.Width - 10, 1);
325                                         
326                                 e.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (this.ColorTable.SeparatorDark), r3);
327                         }
328
329                         base.OnRenderSeparator (e);
330                 }
331
332                 protected override void OnRenderSplitButtonBackground (ToolStripItemRenderEventArgs e)
333                 {
334                         ToolStripSplitButton tssb = (ToolStripSplitButton)e.Item;
335                         Rectangle paint_here = new Rectangle (0, 0, tssb.Width, tssb.Height);
336                         Rectangle button_part = new Rectangle (0, 0, tssb.ButtonBounds.Width, tssb.ButtonBounds.Height);
337
338                         // Paint gradient background
339                         if (tssb.ButtonSelected && !tssb.DropDownButtonPressed)
340                                 using (Brush b = new LinearGradientBrush (paint_here, this.ColorTable.ButtonSelectedGradientBegin, this.ColorTable.ButtonSelectedGradientEnd, LinearGradientMode.Vertical))
341                                         e.Graphics.FillRectangle (b, paint_here);
342                         if (tssb.ButtonPressed)
343                                 using (Brush b = new LinearGradientBrush (button_part, this.ColorTable.ButtonPressedGradientBegin, this.ColorTable.ButtonPressedGradientEnd, LinearGradientMode.Vertical))
344                                         e.Graphics.FillRectangle (b, button_part);
345
346                         paint_here.Width -= 1;
347                         paint_here.Height -= 1;
348
349                         // Paint border
350                         if (e.Item.Selected && !tssb.DropDownButtonPressed)
351                                 using (Pen p = new Pen (this.ColorTable.ButtonSelectedBorder))
352                                 {
353                                         e.Graphics.DrawRectangle (p, paint_here);
354                                         e.Graphics.DrawLine (p, button_part.Right, 0, button_part.Right, button_part.Height);
355                                 }
356                         else if (e.Item.Pressed)
357                                 using (Pen p = new Pen (this.ColorTable.MenuBorder))
358                                         e.Graphics.DrawRectangle (p, paint_here);
359
360                         base.OnRenderSplitButtonBackground (e);
361                 }
362
363                 protected override void OnRenderToolStripBackground (ToolStripRenderEventArgs e)
364                 {
365                         // Don't clear and fill the background if we already painted an image there
366                         if (e.ToolStrip.BackgroundImage != null) {
367                                 if (e.ToolStrip is StatusStrip)
368                                         e.Graphics.DrawLine (Pens.White, e.AffectedBounds.Left, e.AffectedBounds.Top, e.AffectedBounds.Right, e.AffectedBounds.Top);
369                         
370                                 return;
371                         }
372                                 
373                         if (e.ToolStrip is ToolStripDropDown) {
374                                 e.Graphics.Clear (this.ColorTable.ToolStripDropDownBackground);
375                                 return;
376                         }
377                         
378                         if (e.ToolStrip is MenuStrip || e.ToolStrip is StatusStrip) {
379                                 using (LinearGradientBrush b = new LinearGradientBrush (e.AffectedBounds, this.ColorTable.MenuStripGradientBegin, this.ColorTable.MenuStripGradientEnd, e.ToolStrip.Orientation == Orientation.Horizontal ? LinearGradientMode.Horizontal : LinearGradientMode.Vertical))
380                                         e.Graphics.FillRectangle (b, e.AffectedBounds);
381                         }
382                         else
383                                 using (LinearGradientBrush b = new LinearGradientBrush (e.AffectedBounds, this.ColorTable.ToolStripGradientBegin, this.ColorTable.ToolStripGradientEnd, e.ToolStrip.Orientation == Orientation.Vertical ? LinearGradientMode.Horizontal : LinearGradientMode.Vertical))
384                                         e.Graphics.FillRectangle (b, e.AffectedBounds);
385                                         
386                         if (e.ToolStrip is StatusStrip)
387                                 e.Graphics.DrawLine (Pens.White, e.AffectedBounds.Left, e.AffectedBounds.Top, e.AffectedBounds.Right, e.AffectedBounds.Top);
388
389                         base.OnRenderToolStripBackground (e);
390                 }
391
392                 protected override void OnRenderToolStripBorder (ToolStripRenderEventArgs e)
393                 {
394                         if (e.ToolStrip is ToolStripDropDown) {
395                                 if (e.ToolStrip is ToolStripOverflow)
396                                         e.Graphics.DrawLines (ThemeEngine.Current.ResPool.GetPen (this.ColorTable.MenuBorder), new Point[] { e.AffectedBounds.Location, new Point (e.AffectedBounds.Left, e.AffectedBounds.Bottom - 1), new Point (e.AffectedBounds.Right - 1, e.AffectedBounds.Bottom - 1), new Point (e.AffectedBounds.Right - 1, e.AffectedBounds.Top), new Point (e.AffectedBounds.Left, e.AffectedBounds.Top) });
397                                 else
398                                         e.Graphics.DrawLines (ThemeEngine.Current.ResPool.GetPen (this.ColorTable.MenuBorder), new Point[] { new Point (e.AffectedBounds.Left + e.ConnectedArea.Left, e.AffectedBounds.Top), e.AffectedBounds.Location, new Point (e.AffectedBounds.Left, e.AffectedBounds.Bottom - 1), new Point (e.AffectedBounds.Right - 1, e.AffectedBounds.Bottom - 1), new Point (e.AffectedBounds.Right - 1, e.AffectedBounds.Top), new Point (e.AffectedBounds.Left + e.ConnectedArea.Right, e.AffectedBounds.Top) });
399                                 return;
400                         }
401
402                         if (e.ToolStrip is MenuStrip || e.ToolStrip is StatusStrip)
403                                 return;
404                                 
405                         using (Pen p = new Pen (this.ColorTable.ToolStripBorder)) {
406                                 if (this.RoundedEdges == true) {
407                                         e.Graphics.DrawLine (p, new Point (2, e.ToolStrip.Height - 1), new Point (e.ToolStrip.Width - 3, e.ToolStrip.Height - 1));
408                                         e.Graphics.DrawLine (p, new Point (e.ToolStrip.Width - 2, e.ToolStrip.Height - 2), new Point (e.ToolStrip.Width - 1, e.ToolStrip.Height - 2));
409                                         e.Graphics.DrawLine (p, new Point (e.ToolStrip.Width - 1, 2), new Point (e.ToolStrip.Width - 1, e.ToolStrip.Height - 3));
410                                 }
411                                 else
412                                         e.Graphics.DrawLine (p, new Point (e.ToolStrip.Left, e.ToolStrip.Bottom - 1), new Point (e.ToolStrip.Width, e.ToolStrip.Bottom - 1));
413                         }
414
415                         base.OnRenderToolStripBorder (e);
416                 }
417                 
418                 protected override void OnRenderToolStripContentPanelBackground (ToolStripContentPanelRenderEventArgs e)
419                 {
420                         base.OnRenderToolStripContentPanelBackground (e);
421                 }
422                 
423                 protected override void OnRenderToolStripPanelBackground (ToolStripPanelRenderEventArgs e)
424                 {
425                         using (LinearGradientBrush b = new LinearGradientBrush (e.ToolStripPanel.Bounds, this.ColorTable.MenuStripGradientBegin, this.ColorTable.MenuStripGradientEnd, e.ToolStripPanel.Orientation == Orientation.Horizontal ? LinearGradientMode.Horizontal : LinearGradientMode.Vertical))
426                                 e.Graphics.FillRectangle (b, e.ToolStripPanel.Bounds);
427
428                         base.OnRenderToolStripPanelBackground (e);
429                 }
430
431                 protected override void OnRenderToolStripStatusLabelBackground (ToolStripItemRenderEventArgs e)
432                 {
433                         base.OnRenderToolStripStatusLabelBackground (e);
434                 }
435                 #endregion
436
437                 #region Private Methods
438                 private static void PaintOverflowArrow (ToolStripItemRenderEventArgs e, Rectangle paint_here)
439                 {
440                         if (e.ToolStrip.Orientation == Orientation.Horizontal) {
441                                 // Paint down arrow
442                                 Point arrow_loc = new Point (paint_here.X + 2, paint_here.Bottom - 9);
443
444                                 e.Graphics.DrawLine (Pens.White, arrow_loc.X + 1, arrow_loc.Y + 1, arrow_loc.X + 5, arrow_loc.Y + 1);
445                                 e.Graphics.DrawLine (Pens.Black, arrow_loc.X, arrow_loc.Y, arrow_loc.X + 4, arrow_loc.Y);
446
447                                 e.Graphics.DrawLine (Pens.White, arrow_loc.X + 3, arrow_loc.Y + 4, arrow_loc.X + 5, arrow_loc.Y + 4);
448                                 e.Graphics.DrawLine (Pens.White, arrow_loc.X + 3, arrow_loc.Y + 5, arrow_loc.X + 4, arrow_loc.Y + 5);
449                                 e.Graphics.DrawLine (Pens.White, arrow_loc.X + 3, arrow_loc.Y + 4, arrow_loc.X + 3, arrow_loc.Y + 6);
450
451                                 e.Graphics.DrawLine (Pens.Black, arrow_loc.X, arrow_loc.Y + 3, arrow_loc.X + 4, arrow_loc.Y + 3);
452                                 e.Graphics.DrawLine (Pens.Black, arrow_loc.X + 1, arrow_loc.Y + 4, arrow_loc.X + 3, arrow_loc.Y + 4);
453                                 e.Graphics.DrawLine (Pens.Black, arrow_loc.X + 2, arrow_loc.Y + 4, arrow_loc.X + 2, arrow_loc.Y + 5);
454                         } else {
455                                 Point arrow_loc = new Point (paint_here.Right - 9, paint_here.Y + 2);
456
457                                 e.Graphics.DrawLine (Pens.White, arrow_loc.X + 1, arrow_loc.Y + 1, arrow_loc.X + 1, arrow_loc.Y + 5);
458                                 e.Graphics.DrawLine (Pens.Black, arrow_loc.X, arrow_loc.Y, arrow_loc.X, arrow_loc.Y + 4);
459
460                                 e.Graphics.DrawLine (Pens.White, arrow_loc.X + 4, arrow_loc.Y + 3, arrow_loc.X + 4, arrow_loc.Y + 5);
461                                 e.Graphics.DrawLine (Pens.White, arrow_loc.X + 5, arrow_loc.Y + 3, arrow_loc.X + 5, arrow_loc.Y + 4);
462                                 e.Graphics.DrawLine (Pens.White, arrow_loc.X + 4, arrow_loc.Y + 3, arrow_loc.X + 6, arrow_loc.Y + 3);
463
464                                 e.Graphics.DrawLine (Pens.Black, arrow_loc.X + 3, arrow_loc.Y, arrow_loc.X + 3, arrow_loc.Y + 4);
465                                 e.Graphics.DrawLine (Pens.Black, arrow_loc.X + 4, arrow_loc.Y + 1, arrow_loc.X + 4, arrow_loc.Y + 3);
466                                 e.Graphics.DrawLine (Pens.Black, arrow_loc.X + 4, arrow_loc.Y + 2, arrow_loc.X + 5, arrow_loc.Y + 2);
467                         }
468                 }
469                 #endregion
470         }
471 }
472 #endif