none
Trapping the mouse on the primary monitor RRS feed

  • Question

  • I have a WPF application that shall confine the mouse pointer to the primary monitor.

    I tried trapping the mouse using something like this:

        System.Drawing.Rectangle r = new System.Drawing.Rectangle(...);
        ClipCursor(ref r);

    This seemed to work at first glance, but it turned out it is quite easily possible to leave the defined rectangle, e.g. by clicking on the application's title bar or pressing alt-tab.

    My questions are:

    1. Is there any reliable way to permanently confine the mouse pointer to one display?

    2. If not - what other actions / events could liberate the mouse pointer from the above confinement?

    Wednesday, August 14, 2013 2:37 PM