CF - TabControl - how to make the tabs bigger? - c#

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.

Related

C# positioning buttons

I have 3 buttons in my form. What I need to do is when I make the actual form bigger or smaller, the buttons should change their position and size so they look good, so they wouldn't remain the same size and position. I tried to use the anchors, but that does not work very well. What can I use to solve my problem?
You can check dock and anchor properties
http://www.youtube.com/watch?v=afsx1IJULLI
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.dock(v=vs.110).aspx
You should set both left and right, or top and bottom anchors to resize control. If you'll set only one anchor from these pairs, then control will be positioned instead of resizing.
Docking will resize control, because it is equivalent of setting three or more anchors.
Try using TableLayoutPanel, put your buttons inside the columns of the table
Look good is different all the time. I like placing buttons in StackPanel and setting AutoSize property to true. This fixes two issues:
If user has 150% font in Windows settings - your UI does not break;
if you resize window to be very small - your buttons do not enforce minimal width/height and adapt to ratio user has chosen

TabControl with Big Icon

My Windows Forms Applications project has a TabControl with Imagelist. What I need is square tabs with big Icons and Labels aligned Bottom.
Any suggestions?
I presume you mean you would like to change the tab "labels"
I don't think you can put the label underneath the image on a TabControl using just properties; but you could edit the images to contain the text. You can then remove the text from each TabPage to rely entirely on your images.
To make the tabs "square" set the SizeMode to Fixed and set your own size values (e.g. 42,42). You can then set the ImageSize to something similar (e.g. 40,40).
That should achieve what you are after, although you will have to update your images...
note: ImageSize property is a "subproperty" of the Images property of the TabControl.
note: As Hans Passant has said above, it seems you can put text under image by setting DrawMode and handling DrawItem - see this question: Windows Forms C# TabControl ImageList Alignment?.

How to fix this issue that some of the text of the label has been hidden by textbox?

The text of the label is written programmatically:
public Form1()
{
InitializeComponent();
label.Text = data from database;
}
You could set the Dock property each of the controls. Depending on your layout you can set each of them to DockStyle.Left and set the AutoSize property of the label to true. If you can't dock them as is, you can put them inside of a panel and dock inside of the panel. When inside of the panel you can also take advantage of the Fill style of docking (which would also work outside of the panel, but depending on the rest of the controls in your layout it could screw them up. Inside of a panel you can set the label to DockStyle.Left and the TextBox to DockStyle.Fill (to take up the rest of the space)
Set the label's MaximumSize.Width property so it cannot overlap the TextBox. If you don't have enough space vertically then also set the MaximumSize.Height property. You then should also consider setting AutoEllipsis to True so that it is obvious to the user that the text got truncated, a tooltip shows the full text.
An easy way to determine the proper values for MaximumSize is to temporarily turn AutoSize off. Adjust the label size to the maximum size that doesn't overlap anything. Copy/paste the Size into AutoSize. Or leave it off.

change the height of statusStrip

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.

SizeToContent on UserControl

In fact the UserControl lacks the property 'SizeToContent' that we have in Window.
So the question is:
what's the easiest and right way to simulate SizeToContent=WidthAndHeight behavior on UserControl?
UPD... yeah I know it suppose to get that automatically if no Height and Width defined in the container where you're placing a user control.
But it doesn't work when you placing one userControl with defined sizes, into another with no sizes, and altogether they go inside the container.
it this case your second control will take all the space it can get.
Use a Grid and set either the Row and Column height to * for the items you want to size to the window.
Just don't set the Width and Height properties. It will then take on whatever width and height its child requires.

Categories