Mouse Wheel

Hello ,

I need disable the zoom, any way to disable the zoom wheel function on c# ?

Or set the viewport to fixed size (zoom)?

Thank you

You can use RhinoCommon to access set/get the Zoom Scale Factor from Options, if set to 1, zoom is disabled.
Not sure if there is a cleaner way.


Thank you @Jarek, I think that can work fine, but, I dont find the rhinocomon command

can you please post some simple example?


hi @MatrixRatrix

I don’t speak C#, but in Python via RhinoCommon you can do it like this:

    import scriptcontext as sc
    import Rhino.ApplicationSettings as appsettings
    #get zoomscale
    dbZoomScale = appsettings.ViewSettings.ZoomScale
    #set zoomscale
    appsettings.ViewSettings.ZoomScale = 1 



Thank you

@dale, I need acess to delta mouse wheel event, there is any way? Any callback for the whell mouse?


Hi @MatrixRatrix,

There isn’t anything in RhinoCommon that will provide this. Why do you need it?

– Dale

Hi @dale, I need use the delta wheel to rotate a selected object.

I set the same funcion (rotate) with a keyboard Key, but I now I whant use the mouse

I already set the zoomscale to 1, so, I think the zoom is not go be a problem.

Any Idea?

No, I’ve got nothing, sorry.

– Dale

Hello @dale ,

After some searching work I found the solution:

Now I have a small problem, which I have already solved,
but I think there may be a more efficient way.

This method runs with the focus on rhino or without the focus on rhino,
I want the method to be run only when the rhino is focus

There is this function to set the rhino focus:

There is any to check is rhino is focus?

If (Rhino.IsFocusMainWindow()??


Yes this can be done using P/Invoke calling native windows functions like so:

IntPtr foregroundWindow = GetForegroundWindow();
IntPtr undefined = (IntPtr)(-1);
if (foregroundWindow == undefined)
  // unable to find any foreground window

GetWindowThreadProcessId(foregroundWindow, out uint processID);

uint currentProcessID = GetCurrentProcessId();
if (processID == currentProcessID) 
  // Rhino has focus
  // Rhino does not have focus

You have to define the following P/Invoke extern functions:

private static extern IntPtr GetForegroundWindow();

static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);

static extern uint GetCurrentProcessId();

Thank you for your answer, this was also the way I thought to solve it, I thought there could be a simpler way with rhinocommom.

thank you.

Not that I know of. If there is I’m interested as well :slight_smile: