dotnetmonitor.com |
|
|||||||||||
| There are several ways to achieve custom painting
with the ToolStrip API. As with other System.Windows.Forms.Controls, the ToolStrip
and ToolStripItem both have overridable OnPaint methods and Paint events. As with
regular painting, the coordinate system is relative to the client area of the control
i.e. the upper left hand corner is 0,0. The Paint event/OnPaint method for ToolStripItems
behave just as regular control paint events.
In addition to the Paint event/OnPaint method, the ToolStrip API gives finer access to the rendering of the items and container. This is controlled through the ToolStripRenderer class, which has overridable methods for painting the background, item background, item image, item arrow, item text and border of the ToolStrip. The EventArgs for these methods expose quite a few properties (e.g. rectangles, colors, text formats) which can be adjusted as necessary |
|||||||||||
|
|||||||||||