Is it possible some how to make the Text of the Textbox invisible or to hide it so the user can't see it , yet it get's the input/keys from the user?
It's better to rely on the built-in capabilities.
For instance, consider to use the TextBox.PasswordChar property.
You can set ForeColor = BackColor
Paste in your Properties -> Behavior -> PasswordChar symbol you need, empty blanks works too.
Related
I am making a custom MessageBox in my own language (Persian). I want to know which component may I use for the text?
Label is not multiline and TextBox is a little bit not appropriate.
Which component does Visual Studio use itself?
What is the component I specified in the picture?
You can use a label. It has a number of options for laying out the text... One way is to set it to "AutoSize = True".
I support the answer of RQDQ, labels could be enlarged to occupy more than one line.
They have a property named TextAlign. When set to LeftCenter or MiddleCenter you could simulate the behavior of text in a message box. If the text doesn't fit in a single line, the label wraps it automatically on another line. However in this case I will let the property AutoSize to its false default value.
It all depends on what kind of Visual Studio project you are doing. Wpf or Silverlight or Asp.net or even windows, everything will depend upon which kind of project it is.
That looks to me like the MFC style label with an image, or in a browser it would be done with javascript.
You Can Use RichTextBox. I Use it For My Custom MessageBox And it works Correctlly
I have a simple form containing a main view and also some text boxes and an "add" button that I use for adding data that is displayed in the main view (and stored in a text file). What I want to do is to add a little button that will toggle hiding/showing of the adding controls. Such button usually is a small square containing two arrowheads pointing up/down depending on the state. How do I do that?
(I'm sorry for the terrible title, but I don't know the proper name for this. Could anyone tell me?)
I don't think there's something built-in in WinForms for that. When I needed to do something similar, I just changed the Height of the form...
this.ClientSize = new System.Drawing.Size(required_width, required_height);
use a bool for hiding/showing
You can use the forms Height property and the controls could be hidden with Control.Visible = false
I think the word you're looking for is "Collapsible panel".
A quick google/codeproject search will provide you with some links:
http://www.codeproject.com/KB/miscctrl/TgXPPanel.aspx
http://www.codeproject.com/KB/miscctrl/XPCollapsGroupBox.aspx
http://www.codeproject.com/KB/miscctrl/CollapsibleGroupBox.aspx
I suggest you use a SplitContainer control and play with the Panel2.Collapsed property by sitting it to true or false
put the control that you want to hide/show inside panel2 and put the button in panel1. Change the Orientation property to Vertical, and there you go
I have a text box that when it is disabled the text in it is gray and kind of dithered. (This is the standard functionality.)
Is there a way to make this easier to see?
I have tried this:
txtBoxNumber.Enabled = false;
txtBoxNumber.ForeColor = Color.Black;
and that has no effect.
NOTE: This is a .net Compact Framework app, but I am not tagging the question with CF because I think it is the same for normal .net.
txtBoxNumber.ReadOnly = true;
// Then set your styles here...
HTH.
Why don't you make the TextBox.ReadOnly instead? That would allow the user to see & copy the textbox value, but not change it. A read-only textbox is usually rendered the same way as a normal textbox.
From MSDN:
You can use this feature instead of disabling the control with the Enabled property to allow the contents to be copied and ToolTips to be shown.
I often set it to read only or if you have to use disabled set the text box color to white and the font color to black.
Just make the text box Read-Only. And then if you need to set style, set it.
I have a string with dots and carriage returns etc... totally its a big string!
I want to show it in a windows form, so i wanted to know which one will be the good control to show it upon.
Thanks in advance,
Ravi Naik.
Use a TextBox with the Multiline property set to True.
Alternatively you can use a RichTextBox control or a WebBrowser control where you set the DocumentText property.
I would probably use a RichTextBox for displaying the plain text. Check out the AppendText method.
I am developping in C#.
I need to capture a password written inside a Text Box, but would like to not show the password that is being typed, showing instead **** or any other character to hide the password.
How can I do that? I'm sure it's by modifying an attribute, but can't find which one.
http://msdn.microsoft.com/en-us/library/d3223ht2.aspx
set the PasswordChar property of the textbox
Set the PasswordChar property.
There is a property on the TextBox class called "UseSystemPasswordChar" (assuming winforms) that let you do this.
To use your own custom character:
http://msdn.microsoft.com/en-us/library/system.windows.forms.textbox.passwordchar.aspx
To use the system default character:
http://msdn.microsoft.com/en-us/library/system.windows.forms.textbox.usesystempasswordchar.aspx
textBox1.UseSystemPasswordChar = true;
//or
textBox1.PasswordChar = '%';