I have to create some controls similar to a control TextBox. But I want this control can Highlight link as RichTextBox, Because I have problem with RichTextBox so i can't use it. How do I highlight a link in a TextBox? or I have to set each property by a line of code?
I want to display it in a TextBox as shown below:
This is not possible. A simple TextBox control cannot be used to display formatted text.
A hyperlink is just specially formatted text: all it really does is change the foreground color to blue and the text style to underlined. TextBox controls don't allow this type of granularity. All text in the control has the same formatting applied to it.
What you would need to use is a RichTextBox control. This is specifically designed for displaying formatted text, and not only does it allow you to define arbitrary formatting for specific bits of text, but it has built-in support for detecting and highlighting hyperlinks. You say in your question that you had a "problem" with using the RichTextBox, so that is really the question that you should have been asking.
Related
Is it possible to change the forecolor of substring in element text in GridControls's Tileview in devexpress winforms?
What's going to happen is I have a textbox and tileview
In event while textbox textchanged fire, the text matched in tileview's element text will be highlighted
The initial color of tileview's text will be blue and if its match with textbox's text it will be highlighted as gray.
See picture to check the illustration:
Is it possible? or will i need another component to attain this output?
As far I can see there is property group called Appearance (TileView.Appearance) and there you have property called ForeColor. Moreover, you can acces via code by calling
titleViewName.Appearance.ForeColor = <RGB value goes here>
Finally, there is possibility for dynamic customization via event ItemCustomize.
For further information please check official documentation and DevExpress forum. There already existis questions similiar to yours.
You can try to use HTML Text formating for displayed string:
Text = "This is some <color=red>red or <color=black><b>bold</b> text!"
For example, the About dialogue of Notepad has only "Microsoft Software Licence Terms" as a hyperlink but the rest of the text is not. How can I achieve similar result with the Label (or Labels) of WinForms?
I can use two labels, one Label and another LinkLabel, but then the two will not be concatenated naturally (the width of labels may vary by the system font face or the language).
You could use a LinkLabel, then set the LinkArea property. This should highlight the link you want and will also be the only clickable part.
Properties > LinkArea > ... button then just highlight the text part you want as a link
I am displaying text in a rich textbox and i want it to show the html formatting on the text. Is there a way to make a rich textbox display html.
If you push the button on the following link you will see how my out put displays, i would like it done in a rich textbox.
http://neil.fraser.name/software/diff_match_patch/svn/trunk/demos/demo_diff.html
Is there a way to build a rich textbox that can display html???
RTF encoding is different from HTML.
If not, then you need to write your own HTML to RTF converter or find something similar.
Writing Your Own RTF Converter. This guy gives a great breakdown of how the program works along with details of the conversion.
An Extended richtextbox control, Check this out. It may solve your solution
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)
Is there some way that I could create a hyperlink within a Textbox control? The catch: I would like only certain text to act as a hyperlink. For example, StackOverflow.com allows me to make only THIS text act as a hyperlink. Is there some way to do this in C# from withing a Textbox?
Use a RichEditCtrl. Does the text need to be editable? Otherwise you could use Labels and Hyperlinks in a StackPanel.