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

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.

Related

Is there a way to paint a colored border around a Textbox?

I want to create a colored border around a TextBox on a Windows Form, something like what can be done in Android (with the "ID" and "PackSize" EditText widgets):
Is this possible (without writing a gazillion LOC and sacrificing a chicken)?
There is a BorderStyle property, but that does not change the color of the border. The ForeColor and BackColor properties also do nothing helpful.
You could either:
Put the textbox in a slightly larger Panel with a dark BackColor or
Handle the Paint event and draw the border yourself.

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.

borderless form edge

I want to make a borderless form that has a thin black edge (like the first one from the picture http://www.vcskicks.com/remove-titlebar.php ). I want to do this because the form is poorly visible(it combines with my background).
Make a borderless form as described in the article you linked to
Add a Panel control
Set the panel's Dock to "fill"
Change the BorderStyle on the panel to get the effect you want. (BorderStyle.FixedSingle)
Add the remaining controls to the Panel.
Change the Form's padding to 1,1,1,1
Set the Form's backcolor to the color you want for your border
Add a panel
Set Panel to fill the form
Set Panel color to 'control' or whatever

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

Transparent LinkLabel over TabControl

I would like to put a LinkLabel with a transparent background over a TabControl. The tab control has NO tabpage.
As it's not possible to add controls other than TabPages to a TabControl, what I do it add the LinkLabel to the control that contains the TabCOntrol, and then use BringToFront on the LinkLabel. This displays it over the TabControl.
Problem: The LinkLabel displays as transparent (BackColor Property), but instead of showing the TabControl's colour as background, it shows the background colour of it's parent, the control that also contains the TabControl.
From what I understand, this is normal behaviour as a Transparent BackColor means that it'll just take the parent's colour.
Question: Is there any solution to display my LinkLabel with the TabControl's background colour?
Thanks
I may be wrong about this, but I think that if you change the LinkLabel's BackColor property in code (e.g. in your form's Load event, as opposed to just setting it in the designer) to match the color of your TabControl, it will work the way you want it to.
Thanks for your answers. I'm now get what you meant.
Using the tab Control's BackColor won't work, because this property always returns the ColorSystemColors.Control, which is greyish. However, when using visual styles (e.g. XP's default theme), the TabControl's back colour is kind of white. I cannot use white either as the tab control is not pure white, but gradient white...

Categories