change the height of statusStrip - c#

I have a simple windows form with a statusStrip in VS2010, and no matter what I tried, the height of statusStrip does not change, what is proper way of changing the height??
thanks

I just changed the StatusStrip size without problems...
Create a new Form.
Create a StatusStrip.
Set its property "Dock" to "None".
Set its property "Autosize" to "False".
Set its property "Size" with Height = 'the height you need' (I have put it to 100).
If you want, now you can Dock to "Bottom" again.
Add a ProgressBar: it will be 100 Height.
Let me know if this works for you

None of the mentioned approaches worked. Eventually this is the working solution for us:
First, use a TableLayoutPanel with a row at 100% and bottom row with absolute height of 24 (or any desired height you want).
Second, drag and drop the ToolStrip control into the bottom row, and setting the Dock property to Fill. This forces the ToolStrip control to fill the bottom cell of the TableLayoutPanel. Now you have a toolstrip with height 24.

Related

How can I link a component's Size to the Window size?

I am making a simple WinForms program.
I would like to link a component's size to the size of the Window.
Let's say the user enlarges or shrinks the Window by dragging it's borders: I would like that a component gets bigger when the Window does and vice versa.
Let's pretend that we have two Buttons, in the center of the Window, side by side: I want to make them the same size filling the entire width of the Window.
How can I do that?
Sample procedure, using a TableLayoutPanel and 2 Buttons:
Add a TableLayoutPanel to the Form
Edit the Columns and Rows collections so that you have 2 Columns, both sized at 50% and one Row, set to Autosize.
Set the Location.X of the TableLayoutPanel to 0 and adjust its width to the width of the Form.
Set the TLP Anchor property to Left and Right
Adjust-drag the Row height to be ~twice the size of the Button it will host
Add one Button to the Form
Adjust the appearance of the Button as required.
CTRL-Drag the Button to create an exact duplicate
Add the two Buttons to the two cells of the TableLayoutPanel
SHIFT-Select both Buttons and set the Dock property to DockStyle.Fill
You can now adjust the Margin property of the Buttons (still both selected, so the same settings will apply to both) to modify the space between the controls
Re-adjust the TableLayoutPanel's only Row height as needed.
Extra: if you have only these controls on the Form, you may want to fix the MinimumSize of the Form, to avoid that, when the Form is resized, your controls are shrinked beyond recognition, ruining the overall layout: resize the Form in the Designer to a point where the hosted controls layout is compromised, find a suitable minimum size and use this measure as the Form's MinimumSize property. The MinimumSize can be set using only the Width or the Height measure (e.g., (100, 0)). This limits the Form's Width but not the Height. Or the opposite, of course.
If, when dragging the Buttons inside the TableLayoutPanel, the Buttons
are not automatically inserted at the Top-Left position of the cell
and instead they appear positioned in a random place, then the
TableLayoutPanel has gone rogue and needs to be put down. Delete it
and drop another on the Form. Rinse and repeat.
This may happen if you tamper with the layout a bit. Better start over than trying to correct the problem.
TableLayoutPanel Control Overview

Scrolling with multiple controls in panel C#

I have a Form with 4 Controls. One panel, which contains 2 DataGridViews and 1 Label. First there is a datagridview, then the label and then the last datagridview. The Form has a specific size like 600x400. I also want that the first datagridview should have the exact height of all cell height + header cell height from the first datagridview. If its bigger than 400, there should be a scrollbar on the right. If the user scrolls down, he should the the label and the 2. DataGridView. If the Height is less than 400, maybe 300, then it should show already the label and a scrollbar on the right. How could I do that?
Thanks!
The Panel control has a property called "AutoScroll" that you can set to true (in the properties pane while you are in design mode.) This will handle showing and hiding the scrollbar based on the size of the child controls. Make sure that the panel has a fixed height, rather than using AutoSize.
If I am understanding correctly, you want the first DataGridView to size itself based on the size of its contents. To do that, just set AutoSize = true on the DataGridView and it will resize based on its contents.
If you want more specific help, you can post your code and what you have tried, and you may get a better answer.

How to reserve space in Win Form TableLayoutPanel control

I have a question about WinForm TableLayoutPanel control. For example, if I hide the control in the column. it will change the size.
Is there a way to not paint the control in a tablelayoutpanel with column autosize so that the column will still have the control size?
Using Control.Visible = false will make the column width 0.
I need something like hidden in WPF Grid.
You can place a Panel in the TLP and place the control on the panel. Set the panel's background color to the same as the TLP, and it will be invisible. Then hide the control but leave the panel.
This should work fine if your control is a fixed size. If the control size varies, it might be a bit more tricky to do this. You will need to vary the size of the Panel too. Setting it to AutoSize = true and AutoSizeMode = GrowOnly might work.

AutoScroll event in WIndows Forms

I have a windows form with two controls, one mail control (Dock = Fill) and a property control (Dock = Right). The property control is set to AutoScroll. It has some expandable panels and if the user expands too many panels the height of the control is larger than the window height and I set the AutoScroll property in order to automatically display scrollbars in this case - this does work. However the scrollbar is plotted over the property controls. The scrollbars of course needs some place but I would like the property window to grow in width as long as the scroll bar is shown (and hence reduce the size of the main control a bit) so that the scrollbar is on the right side of the property control which is completely shown.
Can you give me a hint? Do I need to change some properties of the controls? Or is there an Event "ScrollBarsShown" or something which I could catch and manually extend the width of the property control?
Thank you very much!
Put these controls in a TableLayoutPanel. The arrangement should be two columns, one row. Column0 would be set to 100%, while Column1 would be AutoSize. The Row could be either.
Then just dock fill the TableLayoutPanel in your form.

CF - TabControl - how to make the tabs bigger?

I have a tab control with tab pages (cf).
The tabs are too small ... can some1 tell me how can i make them bigger?
Increase the size of the TabControl's Font. That takes care of the height. If they are not wide enough then put more text in them. Or set the SizeMode property to Fixed.
The tab size is set by the ItemSize property on the tab control.
Changing SizeMode property to FillToRight\FillToLeft does the trick.
Then you can enlarge the font and both height and width of the tab will grow.
Change ItemSize property in properties window. You can change width and height of the tabs using this property.

Categories