I load files to a TextBox, and I would like some of the information to be hidden and replaced with a LinkLabel (that says something like 'click me to see more'). only when the LinkLabel is clicked will the extra information be shown.
the information to be hidden is marked with "/" in the file.
Can you think of a way to do this? Is it possible? Thanks.
EDIT: Here is an example.
File: Hello everyone have a /nice day/ today and have a nice day /tomorrow too/. Good bye.
TextBox should show: Hello everyone have a 'click me to see more' today and have a nice day 'click me to see more'. Good bye.
If the first LinkLabel is clicked TextBox should show: Hello everyone have a nice day today and have a nice day 'click me to see more'. Good bye.
How about using a RichTextBox instead and handling the RichTextBox.LinkClicked event? In the event handler you can replace the link with the actual text. The RichTextBox has auto url detection, so it can find and create the links for you.
You cannot put clickable zone inside a normal textbox.
You have to declare a personal user control that inherits textbox an handles the click over the text
You can put that extra info into Panel (You can find it in Toolbox-->Containers).
When somebody click LinkLabel you can do this:
Panel.Visible = true;
LinkLabel.Visible = false;
That would do the trick if I understood your question.
If I understand you correctly, your Link Labels are "hiding" the text. What I'd do is assign the hidden text on the Tag property of each of my Link Labels and when they are clicked, swap the Tag into my TextBox.
Related
I need to change the text shown by the "clear" button in the search results shown in the picture.
The language set on the iPad is Spanish, but the button text remains in English, that's why I need to change it.
Here is same kind of question:
Remove or override the "Clear Button" on UISearchDisplayController in a UIPopoverController on iPad?
Here in answer, it is explained how to add custom button in place of Clear button.
Hope this helps
In my WPF application I am having some following type of textbox
So, In this textbox, the text is not written by user it is generated by program, i wish to Highlight the particular text "Enter String Value" and when user clicks on that particular highlighted text only then I wish to fire a event.
Can u guys give me some hint or overview to achieve this. I tried few tricks but can't get success.
Thanks in advance.
Use <RichTextBox> with <FlowDocument>. As I know, TextBox allow you to determinate font (color, size, etc.) only one time, and you wouldn't able to modify color of partial text in one TextBox
I think you can use Regex to get your match from your textbox, and then create Run objects using that match. You can set the Background of the match (runobject.Background = Brushes.Red)
I have a question? How can I wire up an button in a winform to take an input from a label, and put it in a text box to display the result?
I'm confused!
I have 4 labels... I want to be able to have people put input into the labels click the update button, and then display the results in the textbox below.
Any help? Thank you!
OK so basic outline of what you need to do:
1) Go to the toolbox and put textbox(es) on the form for the user to type in.
2) Add at least one label for your output text
3) Add a Button
4) Select each item on the form, go to its properties (f4) and set the Name property for each one to something that you can remember (this is how you'll reference the controls in your code)
5) Double click on the submit button. This will open up an "Event Handler" for Button.Click, which means the code you write will run when someone clicks the button.
6) Write the C# code to do what you want. For instance, this takes the contents of a textbox (tbInput.Text) and copies it to the label text (lblOutput.Text):
lblOutput.Text = tbInput.Text;
Hope this helps...if not, read the first 3 or 4 chapters of any beginning C# book.
You don't put input input into label, you do that in a TextBox. A label is a as its name implies a "label" (fixed unmodifiable text).
Most simply, create a method to handle the Click event of the button, bind it in.
Inside this method get the text from the labels, and then update the textbox with the input.
.NET standard Labels are not the controls you are looking for. Labels are just that...text labels that do not provide for text input. What you want is a TextBox, which you will be able to find in the Visual Studio Toolbox.
If you want the look and feel of a Label, but the functionality of a TextBox, you can modify the TextBox properties accordingly (border style, background color, etc).
Drop a Button onto your form, and from the Designer if you double-click the button, a _Click event handler will be generated in your source file from which you can implement the code to do whatever it is you want to do.
I added the event, I click in the label and press any key, but it doest go to the method. How can I capture?
I don't think labels can receive keyboard input. It will go to the control with focus, and labels can never have focus (by default, I guess you might pull some shenanigans though), most likely your events are going to your main form.
Maybe you could disguise a text box to look like a label.
To add content beyond my other comment. Have you looked at something like input bindings for what you are trying to do?
http://msdn.microsoft.com/en-us/library/system.windows.input.inputbinding.aspx
Specifically, im looking for a way to add links to all the words in my (rich)textbox that start with #. so, if my richTextBox1.Text property equaled "This is an #example of what i want" i would want "#example" to be highlighted. and if its clicked, id want to add a context menu for right click, and just on left click id want it to trigger a void in my program, with the text that was clicked.
Have a look at the following CodeProject article:
Links with arbitrary text in a RichTextBox
http://www.codeproject.com/KB/edit/RichTextBoxLinks.aspx
The code in this article will allow you to insert arbitrary text links into your RichTextBox. When the text link is clicked, the LinkClicked event will fire, and the LinkLabelLinkClickedEventArgs will contain the text of the link you clicked.