Nicholas said:
Jim,
You can override the WndProc method on your control and then handle the
EM_UNDO message (I believe you are using an RichTextBox). You can decide
whether to process this or not.
Hope this helps.
Thanks for the help ... unfortunately it still doesn't work ... it
appears there is no "disable undo queue" that i can call during the
period of time where i highlight the code in the RTF ... my boss
unfortunately wont let me simply disable undo in the editor
Maybe there are some other ideas ... but like I said your the first to
even offer a suggestion on this
Cheers,
Jim
ps here's the code i tried to catch events ...
/// <summary>
///
/// </summary>
public class MyHighlightableRTF: RichTextBox
{
public bool ishighlighting;
public MyHighlightableRTF(): base()
{
}
protected override void WndProc(ref System.Windows.Forms.Message message)
{
switch (message.Msg)
{
case (int) 0x0304://EM_UNDO:
{
if (ishighlighting)
{
return;
}
else
{
base.WndProc(ref message);
}
break;
}
case (int) 0x00C7:
{
if (ishighlighting)
{
return;
}
else
{
base.WndProc(ref message);
}
break;
};
case (int) 0x00C6: //EM_CANUNDO 0x00C6
{
if (ishighlighting)
{
return;
}
else
{
base.WndProc(ref message);
}
break;
}
case (int) 0x0114://WM_HSCROLL
{
if (ishighlighting)
{
return;
}
else
{
base.WndProc(ref message);
}
break;
}
case 0x0115: //(int)WM_VSCROLL
{
if (ishighlighting)
{
return;
}
else
{
base.WndProc(ref message);
}
break;
}
case 0x00CD: //EM_EMPTYUNDOBUFFER
{
if (ishighlighting)
{
return;
}
else
{
base.WndProc(ref message);
}
break;
}
default:
{
base.WndProc(ref message);
break;
}
}
}
}