C# .NET - Disable Text Zoom in RichTextBox on Mouse wheel

Asked By Kaushik Jaimalani on 25-May-06 08:50 AM
Hi
Consider a RichTextBox with same data in it. Now when a user presses Ctrl key and Scrolls using the mouse the data present in the RichTextBox Zooms In/Out.
I want to disable the zooming of text in RichTextBox.  I tried the following code and it worked on my machine but didnt work on other developers machine (not sure why).
private void RichTextBox_MouseWheel(object sender, MouseEventArgs e)
{
  base.ZoomFactor = 1.0f;
}
How can i disable Text Zoom In/Out? Is there a property in RichTextBox which i am missing? Please let me know.
Thanks in advance
Kaushik
Development Environment
.Net Framework 1.1
Windows Forms
Microsoft Windows XP Professional Version 2002, SP2

re

Asked By Rupali Randhave Kolhe on 27-May-06 02:23 AM
http://msdn2.microsoft.com/en-us/system.windows.forms.richtextbox.zoomfactor.aspx
Varun replied to Rupali Randhave Kolhe on 14-Jul-10 05:03 AM

Try this:


void


ExRichTextb_MouseWheel(object sender, System.Windows.Forms.MouseEventArgs e)

{


if (ZoomFact != currentZoomFactor)

base.ZoomFactor = currentZoomFactor;

}




where ZoomFact is  ,



public float ZoomFact

{


get



{


return base.ZoomFactor;

}


set



{


base.ZoomFactor = value;

}

}


and


currentZoomFactor =

base.ZoomFactor; //initialize this in the constructor of your RichTextBox.

 

where currentZoomFactor is 1.0f;