Toolstrip Drop Down Button Not Large Enough

Well the answers from stackoverflow looked promising, but no luck yet. Also, I may not have quite enough experience yet to see it.

Simple I thought: I am looking for a larger drop down arrow in a ToolStripDropDownButton as an item in the collection. The tool strip drop down button is very small. I would like it to be 3 times the current size. Slightly larger would be of benefit as well. The drop down, when selected, reveals a menu of items.

Is it possible to use the ToolStripRenderer or a user control to get this as desired (unless there is a property I do not see) or ?? I am not that familiar with custom controls in a Winforms environment, so any help with snippets or direction would be helpful. In other words, wondering, if a user control is needed, what do I need to make it work for this scenario? That said, I am looking for any solution that will work. Thanks for any help/ideas!!!!

Answers


Try making your own Renderer and override the OnRenderArrow method:

public class MyRenderer : ToolStripProfessionalRenderer {
  protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e) {    
    if (e.Item.GetType() == typeof(ToolStripDropDownButton)) {
      Rectangle r = e.ArrowRectangle;
      List<Point> points = new List<Point>();
      points.Add(new Point(r.Left - 2, r.Height / 2 - 3));
      points.Add(new Point(r.Right + 2, r.Height / 2 - 3));
      points.Add(new Point(r.Left + (r.Width / 2),
                           r.Height / 2 + 3));
      e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
      e.Graphics.FillPolygon(Brushes.Black, points.ToArray());
    } else {
      base.OnRenderArrow(e);
    }
  }
}

Then apply it to the ToolStrip:

toolStrip1.Renderer = new MyRenderer();

You may have to change the button's AutoSize property to false and set the width of the button yourself to get the proper space.


You can change the size of the button by setting the AutoSize property to false and then setting the Size property to what you need. As far as making the arrow bigger, I don't think you can do that, but at least it will make the button bigger.


Need Your Help

iPad 1 unable to record MPEG4AAC recording?

ipad ios5 xcode4.2 avaudiorecorder ios5.1

I have been trying to record kAudioFormatMPEG4AAC format on iPad app, the recording is working fine on iPad2 &amp; iPad3, but not on iPad1. Here iPad1 &amp; iPad3 have iOS 5.1, and iPad2 has iOS 5....

Eclipse force handlers to to re-evaluate

eclipse eclipse-plugin swt eclipse-rcp jface

How can I force Eclipse to do a re-evaluation of the activeWhen-conditions of all handlers?