Hide/Show Richtextbox Bottom Border in WPF? - c#

i want to hide/show bottom border of richtextbox in WPF.I already use 10,10,10,-10 for hiding bottom border.it works.but my text content are partially shown for using this method and i cant get the proper panning.So how to hide/show bottom border without extent the value in negative.
Regards
Arjun

Set the bottom border thickness to 0.
BorderThickness="10,10,10,0"

Related

I want to align controls that stretches horizontally like google chrome browser address bar

I am trying to align few buttons and a textbox, like the Google Chrome browser address bar, which stretches itself when the user maximizes windows form.
I tried anchor and dock, but 1st control from the left and last control from the right side align themselves but other middle controls stays put.
Please anybody tell me how to properly align controls?
Here's my controls in panel:
After stretch:
Don't use Dock property. For the controls before the TextBox, leave the Anchor property to default, i.e., Left, Top.
For the TextBox, set the anchor to Left, Right, Top.
And for controls after the TextBox, use Right, Top.
This will resize only the TextBox when you change the window size.

Why aren't user control borders same for each edge?

I have a custom UserControl that has a TextBox inside of it. But the user control borders have a problem. Because they are not symmetric at all. That's the what I say below.
As it can be seen, the border-right and border-left are not same, as the top and the bottom. Gray colored thing is the textbox. How can I make the borders same for all edges?
That is because the BorderStyle property of the user control is set to Fixed3D, set it to FixedSingle to draw the border around the user control or set it to NONE.
Note:
The first picture is with the Fixed3D.
The second is the FixedSingle.
The last is when the BorderStyle is set to None.

Make UserControl resize when Dock = Fill

I have a problem with UserControl that I'm crafting. It consists of TableLayoutPanel with another TableLayoutPanel in it with ListView inside. I want to make it resizable so that it will fit in left panel of my app and behave somewhat like Toolbox in Visual Studio. The problem is that my control doesn't scale when I resize panel.
UserControl is embedded in panel with Dock = Fill and Anchor = Tob, Left, Bottom, Right. Also all controls in it are made that way. How can I fix this?
EDIT: It's WinForms, not XAML.
Use a split panel and put your UserControl in the left panel and Dock.Fill it.
You're probably looking for the AutoSize properties on the TableLayoutPanel and the AutoSize ColumnType of that panel.
You can achieve something like a Dock = Fill by simply auto-sizing the table layout panel (GrowAndShrink) so that it will always fit your inner control.
Please post your designer code to see how you embedded the controls in which other control.
I suspect your resize problem come from your resizing strategy of control inside the TableLayoutPanel.
The table layout panel is tricky. Regarding the resize strategy you want to follow inside a cell of the table panel, the control in the cell have either to be Dock.Fill or Anchor = Top, Left, Bottom, Right.
Basically:
Il you want the grid cell to adapt to the size of the control, then have the control in the cell Anchor = Top, Left, Bottom, Right and set the row/column to autosize.
If you want the control in the cell to adapt to the cell size, use Dock.Fill on it and use a percentage or a absolute value to size your cell.
The behavior of the TableLayoutPanel is best described in the MSDN documentation.

How do I remove the resize gripper image from a StatusStrip control in C#?

I need to show a StatusStrip control docked top instead of bottom.
User requirement. Long story.
How do I get the StatusStrip to display without the dots in the right corner?
Set the SizingGrip attribute to false:
StatusStrip.SizingGrip = false;

My own tableheader?

I want to make a table header:
The steps I have taken
Made a user control
Placed a TableLayoutPanel on it(this is basically a grid layout?)
Added and removed the number of columns/rows I wanted
Placed a label in each cell
For each label set its dock to fill and borderstyle to fixedsingle
However the borders are not lined up against each other but instead there is a gab, that makes the whole thing look very ugly.
The border size is also very small, how can I make it bigger?
You can remove the gaps by changing the lable margin property to 0,0,0,0 but the borders will double up in thickness where they meet (Leaving the outer border thinner)
You can disable the borders on the individual labels and use the TableLayoutPanel CellBorderStyle property to get a consistent look with several options for line styles but this will affect all cells, not just the header.
If the TabelLayoutPanel is a fixed size perhaps a background image?
I have no idea how to make the borders thicker in winforms, This is where WPF rules but beats you over the head for using it.
Mike

Categories