I am using report viewer inside a windows form and I am trying to adjust the height of the ToolStrip
of the ReportViewer
.
I tried to adjust the AutoSize
property to false
then adjust the Height
but the height didn’t change:
var toolStrip = (ToolStrip)reportViewer1.Controls.Find("toolStrip1", true).First();
toolStrip.AutoSize = false;
toolStrip.Height = 100;
How can I adjust the height of Report viewer toolbar in windows form? Any suggestions would be much appreciated.
The ToolStrip
of the report viewer has Dock = Fill
inside a custom control (report toolbar). The report toolbar has overridden is size-related methods and properties and looks into the PreferredSize
of the ToolStrip
to set the bounds.
Properties like Padding
, ImageScalingSize
, MinimumSize
, Font
contribute to determining the preferred size of toolstrip; so you can set either of mentioned properties.
The most effective property is MinimumSize
:
var toolStrip = (ToolStrip)reportViewer1.Controls.Find("toolStrip1", true).First();
toolStrip.MinimumSize = new Size(0, 100);
toolStrip.Parent.Height = 0; // No effect, just to force recalculation of height.