tags:

views:

140

answers:

1

I've not bothered with panels, docking, or anchors. I've simply thrown together a ToolBar control (not ToolStrip) and seem unable to size it.

System.Windows.Forms.ToolBar tb = new System.Windows.Forms.ToolBar();

// Reports 292x28 (approx) if I check width and height
// Basically the width of the form and I assume a default height
tb.Size = new System.Drawing.Size(195, 48);


// Reports 48x48, but does not actually create buttons of that size
// (It reports 48x48 because I'm retrieving 48x48 icons from a ResourceManager (resx))
tb.ButtonSize = new System.Drawing.Size(48, 48); //

The closest thing I found to making my ToolBar taller was:

http://bytes.com/topic/c-sharp/answers/241614-changing-height-toolbar-button

Although it's rather dated. And I didn't understand it. ToolBarButtons don't have Height, Width, or Size properties.

I'm using SharpDevelop, coding completely by hand on Vista, with all the .NET frameworks.

EDIT:

Here is the EXACT code that I am currently using.

#region ImageList/Toolbar
ImageList toolbarImages = new ImageList();
Image wizardToolbarImage = (Bitmap) rm.GetObject("wizard");
Image optionsToolbarImage = (Bitmap) rm.GetObject("configure");
toolbarImages.Images.Add(wizardToolbarImage);
toolbarImages.Images.Add(optionsToolbarImage);      

ToolBar toolbarMain = new ToolBar();
toolbarMain.Size = new Size(195, 25); // no effect
ToolBarButton wizardToolbarButton = new ToolBarButton();
ToolBarButton optionsToolbarButton = new ToolBarButton();
wizardToolbarButton.ImageIndex = 0;
wizardToolbarButton.ToolTipText = "Wizard!";
optionsToolbarButton.ImageIndex = 1;
optionsToolbarButton.ToolTipText = "Options!";
toolbarMain.Buttons.Add(wizardToolbarButton);   
toolbarMain.Buttons.Add(optionsToolbarButton);

toolbarMain.Appearance = ToolBarAppearance.Normal;
toolbarMain.ButtonSize = new System.Drawing.Size(48, 48); // no effect
toolbarMain.ImageList = toolbarImages;
toolbarMain.ButtonClick += new ToolBarButtonClickEventHandler(toolbarMain_Click);

Controls.Add(toolbarMain);
#endregion
+1  A: 

In just about every winforms application I've written, regardless of language or framework, the toolbar could only be made taller by using larger icons.

Soviut
+1. That's been my experience as well.
David Stratton