Create your own class that derives from RichTextBox and try one of two things:
- Override OnMouseWheel() and do not call base.OnMouseWheel(). Unfortunately, I don't think any processing actually happens in the OnMouseWheel() method aside from firing events, so this probably won't solve your problem.
- Override WndProc and handle the WM_MOUSEWHEEL message yourself. Make sure you pass all other messages to base.WndProc(). I'd say this has a good probability of solving your problem.
For #2, something like this should work:
Code:
public class NoScrollRichTextBox : RichTextBox
{
const int WM_MOUSEWHEEL = 0x020A;
protected override void WndProc(ref Message m)
{
// This will completely ignore the mouse wheel, which will disable zooming as well
if (m.Msg != WM_MOUSEWHEEL)
base.WndProc(ref m);
}
}