Alex Clark
7/19/2008 7:05:00 PM
Thanks Linda, you're a star :-D
-Alex
"Linda Liu[MSFT]" <v-lliu@online.microsoft.com> wrote in message
news:qB4DA9H6IHA.3320@TK2MSFTNGHUB02.phx.gbl...
> Hi Alex,
>
> Thank you for your quick response!
>
> I perform a test creating a new class derived from the ToolStripRenderer
> class. I don't override any methods in the derived class. Then I use this
> custom ToolStripRenderer on a ToolStrip that contains a
> ToolStripSplitButton. When I run the application, I don't see an arrow
> drawn in the dropdown button part of the ToolStripSplitButton as you said.
>
> If I derive the custom renderer class from the
> ToolStripProfessionalRenderer class and don't override any methods, the
> arrow is drawn in the dropdown part of the ToolStripSplitButton. So it's
> obvious that the ToolStripProfessionalRenderer class paints the arrow by
> itself.
>
> Using Reflector, I find that the ToolStripProfessionalRenderer class calls
> the base.DrawArrow method in the override OnRenderSplitButtonBackground
> method. This is the answer!
>
> So the solution to your question is to call the base.DrawArrow method in
> the override OnRenderSplitButtonBackground method. The following is a
> sample:
>
> class MyRender : ToolStripRenderer
> {
> protected override void
> OnRenderSplitButtonBackground(ToolStripItemRenderEventArgs e)
> {
> base.OnRenderSplitButtonBackground(e);
> ToolStripSplitButton item = e.Item as ToolStripSplitButton;
> base.DrawArrow(new
> ToolStripArrowRenderEventArgs(e.Graphics, item, item.DropDownButtonBounds,
> SystemColors.ControlText, ArrowDirection.Down));
> }
> }
>
> I have tested this in my application and it works on my side.
> If you have any question, please feel free to let me know.
>
> Sincerely,
> Linda Liu
> Microsoft Online Community Support
>
> Delighting our customers is our #1 priority. We welcome your comments and
> suggestions about how we can improve the support we provide to you. Please
> feel free to let my manager know what you think of the level of service
> provided. You can send feedback directly to my manager at:
> msdnmg@microsoft.com.
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>