So I'm programming a text editor and there's a problem. If I set the selectionfont within my rich text box to say bold by check marking a box then it turns to bold which is fine, but what happens and hopefully people can understand this is is a section of text hasn't been turned to bold and the user clicks or moves back there then the text starts typing as non-bold
but the checkbox remains checked which at the very least is dorky, but then the user has to un-check and re-check the box to get it to start typing bold again.
One event that DOES work is using the OnLocationchange which you could then use something like
if (txtbox.SelectionFont.Bold == true && checkbox.checked == false)
{
checkbox.checked = true;
}
So in the event the user changes location to text anywhere that is bold and the box isn't checked it automatically gets checked again:: if you notice modern day office programs will select and un-select bold etc. as you click around.
The problem I see with using the OnLocationchange event is you're constantly firing that event which seems to be resource heavy am I right? So anytime you do ANYTHING within that RichTextBox it's constantly checking to see if the SelectionText is bold etc. but that seems inefficient?
That said there doesn't exist and event; but could you create a onselectionFontChange event. This would only fire an event when the selection text changes not every time the location changes?
Also what are other solutions to this problem?
Thanks in advance guys.

New Topic/Question
Reply



MultiQuote






|