Reputation: 175
So I have a TextBox
in my WinForm that I would want to design. I would like to achieve a text box that has no border except for its bottom part, just like the one in the Material Design Website:
But I have a few problems. I don't know how to code this one. Is there any way to code it like the one we use in CSS, i.e. border-bottom
or something?
Upvotes: 2
Views: 4950
Reputation: 1985
I was able to create a design near the one in your image but not in the way you want it.
Here's the one I managed to make:
What I used:
textbox
for the search inputlabel
for clearing the input, line shape
(found in Visual Basic PowerPacks
in the toolbox) for the border effect
ORlabel
having a long underscore
( _ ).picturebox
for the search iconProcedure:
For the textbox
, set these properties:
BorderStyle : None
BackColor: 0, 188, 212
(or the color of your form's background) but that's the exact color based on the image you providedForeColor: White
For the clear button, I just used a label
(it still has a click event), set the text to: "✖" and the BackColor
to Transparent
.
For the border
effect, just draw a line shape below the textbox
then set:
BorderColor: White
BorderWidth
to 3
If you are using the label
with underscores, just place it under the textbox
.
Sorry got bored that I even included everything even though you're just asking for the border
(still wondering why did I answer this on the first place). I hope this can still be of any help.
Upvotes: 3