الثلاثاء، 4 أكتوبر 2011

How to prevent Paste image into Richtextbox

Salam Alikm

Sometimes you need to use Richtextbox to take the benefits of  text formatting which can not in Textbox but user can paste image using Ctrl + V and you want to accept only text So here's the solution to accept text only in Richtextbox


private void richTextBox1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs keyEventArgs)

{

if (Clipboard.ContainsImage() && keyEventArgs.KeyCode == Keys.V&& (Keys.Control) != 0)



Clipboard.Clear();



0 التعليقات: