Is there any easy way to implement editable text field in Win2D?
I'm trying to make a simple text tool, which would add text over image (just like in MS Paint).
By clicking inside the text's boundaries, it'd make that text ´selected`. Selected text would draw lines around it's area according to it's boundary box, and start blinking a caret in the clicked position. By clicking elsewhere, it'd unselect the text (hides possible caret, text selection and boundary box).
I was thinking about a simple solution with XAML TextBox, but I'm afraid that it doesn't support all of the effects that Win2D does (f.ex warping the text).
What would be the correct way to do it?
Related
When I edit a text in webbrowser component in C#, a border showing around it.
I want to edit the text without a border. When I click the text block twice,
the border can be seen.
I want a source code that I click once on the text, it can be edited without showing a border.
The webbrowser component is in edit mode and I click on a text block or an image. Around the image there are eight boxes in order to resize.. When I click a text block, a div tag for example, the boxes also can be seen.. and I click twice, the text is editable with a border around it.. This border is not needed..
I am using a WFA which has a ToolStripMenuItem that is supposed to search for a word in a textBox and highlight it. This is the highlighting code.
first = first index to be highlighted
, length= number of characters to be highlighted.
textBox2.SelectionStart = first;
textBox2.SelectionLength = length;
//scroll to the caret
textBox2.ScrollToCaret();
everything seems to be working well. However, If the mouse cursor isn't inside textBox2 (say in another textBox). The highlighting doesn't work. Is there a way to make it work regardless of the position of the mouse cursor? in other words, is there a way to change my code to make it highlight the text in textBox2 even if the mouse cursor wasn't inside textBox2 before hitting the ToolStripMenuItem?
P.S. It's worth mentioning that I am using c# in VS 2010
Try:
textBox2.Focus();
before you run the code that highlights the text. This will move input focus (and your cursor) to the textbox
just use richtextbox and change the backcolor of the text.
this way you can use multiple highlights at a time and the highlight won't be lost after the user focus the textbox by mouseclick. Additionally you can save all postions and automatically select the textpart if the user clicks into the highlighted area.
you can also show the selection like LarsTech mentioned, but after the user clicks inside the textbox the selection will get lost.
does someone know, how to make various parts of RichTextBox text to blink in .NET on Winforms?
Or maybe this is already done?(Google gave no help)
Thank you
First you need a timer. after selecting a text and click the blink button save the region of the text (startposition:endposition) to an array. With the timer change every second(for example) the color of the text in regions saved in the array. if the text is changed check if the change occured in a region and inrecrease or shrink the region. if the text is change outside a region check if the blinking text is moved and move the region also backward/foreward.
I'm trying to color a specific line's background in a RichTextBox.
I need the line's background to be colored all the way to the end of the right side of the control.
I tried using the SelectionBackColor property, but it colors only until the end of the line.
Does anybody know of a way to do this?
thanks :)
mmm, I believe you cannot do it without some custom painting, because as you said, with RTF formatting you format text so if you do not have text ( chars or white spaces or tabs... ) you cannot reach those parts of the control which are completely empty, unless you do change the whole control background color...
Bit messy, but if you don't want to go ahead with custom painting the control. You could make the textbox transparent, then add an image behind the control which has the line selected. You could then change the Image.Location.Y value on the TextChanged event.
Customizing the stock Windows rich text control is possible, but they didn't make it easy. If I were you, I would do what I did: Purchase a better text control.
In a richtextbox I see there's DetectURLs and an event to go along with that...
Is there a way to set up a word or series of words to act as a hyperlink even though they are not a hyperlink? My specific use is that I'm writing a ticker program that will scroll information across the bottom of the screen, I would like for some information to be clickable without putting the long, messy URL of the target. Anyway I can do this?
Links with arbitrary text in a RichTextBox
http://www.codeproject.com/Articles/9196/Links-with-arbitrary-text-in-a-RichTextBox