I inherited a windows forms 2003 app which showed the paint tools in a pane, using a toolbar. I continued this approach, but I've been asked by the client one time too many for changes that you just can't do in a toolbar, so I've removed it and added a button for each tool. My problem now is that standard buttons don't seem to offer a drop down menu, only a context menu. Am I right in thinking this If so, what's my best option
1 - an owner drawn combo box
2 - write my own control
3 - trawl the web and assume that someone else must have written this before me

Drop down menu on a button ?
lominup
Thanks, but what I want is for users to click the button OR the menu. For example, I have a highlight tool. You can highlight an ellipse, a rectangle, or freehand. So, the button shows the last tool you used, and you can select it there. The drop down allows you to choose between the three options. I don't want the menu to come up every time.
Ashok76
I was on 2003, the app is in 2005 now, but toolstrips are no good for what I want, so I've written a custom control, thanks.
The issue was that I wanted to have individual buttons that I had complete control over, in terms of position, spacing, etc.
Ravinder Singh
Like the forward and back buttons in IE6
I don't think there's anything like that in VS 2003. If you're not able to upgrade to VS 2005 and the tool strips (*much* better) then I think a custom control is the way to go.
Dean Wills MSFT
Hi cgraus,
Thanks for contacting Microsoft.
Based on your problem, it's a better way to use DropDownButton to indicate "drop down menu" as your first choice. In .net framework 2.0, ToolStrip substitutes ToolBar and you can visually add a DropDownButton onto your ToolStrip.
Codesnap:
private void InitializeComponent()
{
............
// toolStripDropDownButton1
//
this.toolStripDropDownButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripDropDownButton1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.openToolStripMenuItem,
this.closeToolStripMenuItem});
this.toolStripDropDownButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripDropDownButton1.Image")));
this.toolStripDropDownButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripDropDownButton1.Name = "toolStripDropDownButton1";
this.toolStripDropDownButton1.Size = new System.Drawing.Size(29, 22);
this.toolStripDropDownButton1.Text = "File";
//
// openToolStripMenuItem
//
this.openToolStripMenuItem.Name = "openToolStripMenuItem";
this.openToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.openToolStripMenuItem.Text = "Open";
//
// closeToolStripMenuItem
//
this.closeToolStripMenuItem.Name = "closeToolStripMenuItem";
this.closeToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.closeToolStripMenuItem.Text = "Close";
...........
}
We sincerely hope this can be of help. If anything is unclear, please don't hesitate to get in touch. Any comments and further feedback from you will be welcome and highly valued.
Cheers,
Cleo
TSZ
Hi cgraus,
Thanks for your feedback. Great job that you solved the problem yourself. Actually,
there're always methods to render controls in .NET Framework 2.0. Here's a link for you, which enables convenience to draw arrows on your control:
http://msdn2.microsoft.com/en-US/library/system.windows.forms.scrollbarrenderer.drawarrowbutton(VS.80).aspx
We sincerely hope this can be of help. If anything is unclear, please don't hesitate to get in touch. Any comments and further feedback from you will be welcome and highly valued.
Cheers,
Cleo
Scott0620
Hi Cleo. Did I contact Microsoft Cool :-)
No, you've misunderstood. I HAD a toolstrip, and now I want to just put buttons on my form, outside of any sort of toolbar framework. I solved the problem last night by deriving a control from the Button class and adding code to draw an arrow and manage a menu. If there's a built in solution that I failed to see, I'd appreciate your sharing it with me, otherwise I thank you for offering some help, although it wasn't quite what I was after.
velibicer
If you want to avoid the right-click context menu, you can simply show another context menu on the click event:
private void button1_Click(object sender, System.EventArgs e)
{
// show a context menu directly below the button
this.contextMenu1.Show(this, button1.Location + new Size(0, button1.Height));
}