I am making my own notepad, and when i paste text to my RitchTextBox, the text comes with it's own format...
how can I prevet the font change ??
Thanks in advanced.
Printable View
I am making my own notepad, and when i paste text to my RitchTextBox, the text comes with it's own format...
how can I prevet the font change ??
Thanks in advanced.
In the Change event of the RTB, set the Font type (and/or Font Size) to whatever you want.
Any text pasted into will be in the font type/size format.
when I change the font will it change the font of the text that I have pasted, or to the entire RTB ??
can you give me an example?
It will change the font for the entire RTB, but that it what it sounds like you want to do.Quote:
Originally Posted by Trojan
Example: Your RTB standard font is MS Sans Serif. You paste something into the box that is Arial. Now, you have two different fonts types (as suggested by your original question). If, in the change event your set your font to MS Sans Serif, it will change the Arial that was pasted to that, but all the rest of the text will remain unchanged because it is already MS Sans Serif.
mmm...
but you see when I do that, the entire rtb goes bad... it loses the format...
What I was thinking is to disable the built-in paste the RTB has, then all I have to do is to make my code put the text in the text box, without the any format set to it...
Ok. So you have your own "paste" routine that you want to use instead Windows "paste"?Quote:
Originally Posted by Trojan
I'm not getting what you mean by "make my code put the text in..."
That is what I ment. that way I can control what format I Paste the text and control other stuff...Quote:
Originally Posted by Hack
Well, the richtextbox, like the standard textbox, has its own right mouse click popup menu which you can replace with your own.Quote:
Originally Posted by Trojan
You could also clear the clipboard if they pressed Ctrl-V in your textbox so they couldn't use Windows to do the paste.
well...
If I make a menu Item with shortcut "Ctrl+V" set it does not bypass the paste code of the windows...
I guess I need to find a solution in API...
You can capture Ctrl_V in the keydown event of your RTBQuote:
Originally Posted by Trojan
VB Code:
Private Sub RichTextBox1_KeyDown(KeyCode As Integer, Shift As Integer) If (Shift And vbCtrlMask) = vbCtrlMask And KeyCode = vbKeyV Then 'do something else - clear the clipboard maybe End If End Sub