mouse

Trap mouse in WPF

蹲街弑〆低调 提交于 2019-12-04 19:12:19
I have a canvas in which I have an image. I can move that image using the mouse (drag-n-drop). I want to prevent the user to move the image outside of the canvas. Is there any way I can trap the mouse pointer so it can only move inside the canvas? So when the user tries to move the mouse outside the canvas, the cursor would remain at the edge of the canvas. One example of this behavior would be when moving a window, you can't move it on the taskbar. When you try to move it on the taskbar, the mouse cursor stays on the edge of the taskbar, refusing to move on top of the taskbar. Martin

Snap to grid mouse locking up

徘徊边缘 提交于 2019-12-04 17:04:38
I am working on an application which draws a simple dot grid. I would like the mouse to snap between the points on the grid, eventually to draw lines on the grid. I have a method which takes in the current mouse location (X,Y) and calculates the nearest grid coordinate. When I create an event and attempt to move the mouse to the new coordinate the whole system becomes jerky. The mouse doesn't snap smoothly between grid points. I have copied a code sample below to illustrate what I am attempting to do. Does anyone have any advice they could offer me as to how I can eliminate the jumpiness

capturing right-click+left-click with autohotkey; unexpected behaviour

旧街凉风 提交于 2019-12-04 14:35:13
I want to capture the key event "right mouse button pressed, then left mouse button pressed". No problem in autohotkey. However I am having trouble with still allowing the right-mouse key to work alone. 1) this works: RButton & LButton:: Send X Return works as expected: If I press right mouse button, then left mouse button, "X" is sent to the active window right-click event is captured by Authotkey: no context menu appears when I press the right mouse button alone. This is the intended outcome 2) this works ~RButton & LButton:: Send Y Return works as expected: If I press right mouse button,

Override mouse using Chromium embedded framework

一曲冷凌霜 提交于 2019-12-04 14:06:37
问题 Is it possible that in file cefclient_win.cpp LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) mouse messages are filtered out, as I only get WM_MOUSEMOVE message through? It seems like left or right clicks are handled before the WndProc gets a hold of them. How do I disable right mouse click in particular? 回答1: The way I solved it was by adding a mouse hook to the thread created by CEF for each browser window: // Hook to disable right mouse clicks LRESULT

Bluetooth + simulating mouse

雨燕双飞 提交于 2019-12-04 13:43:55
问题 anyone know if its posible to make an application to simulate a touchscreen mouse or trackpad by bluetooth?? How can I make that the PC (or MAC) knows me as a mouse device? Regards, Juan 回答1: You should have a look at the Bluetooth HID specification. It may be possible, depending on the stack of the device that you are using to emulate a mouse/trackpad. I'm not familiar with the stack on Android (assuming that's the platform you're using from the tag on your question) so I don't know if it's

How to do Hit testing in GDI+ for rotated shapes with real shape measurements (inches)?

守給你的承諾、 提交于 2019-12-04 13:42:23
问题 Given I have a canvas that contains many shapes, lets say rectangles for now. Each shape has a location (inches), size(inches) and rotation angle(degrees). When a mouse click event happen inside the canvas for a location (x,y) in pixels. I want to check if the clicked mouse position is inside/within a specific shape, considering the rotation angle and measurement unit conversion. Can you help? 回答1: Your question is awfully short on details, I can only provide a generic answer. Do it

Algorithm to recognise mouse movements

给你一囗甜甜゛ 提交于 2019-12-04 12:48:46
Am wondering if there has been any research/algorthms which specify the amount of deviation of the mouse while recognizing characters like say "?" drawn using the mouse. Something a sort of optical character recognition, but probably a simpler version. Is there some algorithm using which I can say that a question mark drawn by the user is really a question mark and not something else with some amount of accuracy ofcourse. Something like what windows tablet software allows (while writing with the tablet stylus). Thank you for your time. Mouse gestures recognition Dynamic Time Warping is the

Java Robot mouse move: setting speed?

时光怂恿深爱的人放手 提交于 2019-12-04 12:30:29
The Java Robot class allows one to move the mouse as if the actual physical mouse was moved. However, how does one move the mouse from Point1 to Point2 in a humane (and thus not instant) manner? Aka, how does one set the speed of movement? If no such speed is possible with the Robot class, thus if the mouse can only be moved instantenously, what kind of "algorithm" should be used to mimic a human's mouse movement? Should it move the mouse pixel by pixel with a certain incrementing speed? The Robot class has a delay(...) method that you can use to control movement from point to point. Try a few

Having trouble creating a class based implementation of OpenCV's mouseCallback function

帅比萌擦擦* 提交于 2019-12-04 12:26:26
问题 As the title suggest, I'm having some trouble implementing OpenCV's mouseCallback function in a class based C++ structure. Allow me to explain. I have defined a class called BriskMatching in which I have created a member function named mouseCallback with the correct parameters that OpenCV requires (please see the code snippet below). **Briskmatching.h** class BriskMatching { public: BriskMatching(); ~BriskMatching(); public: void mouseCallback(int event, int x, int y, int flags, void *param);

Is it possible to put the mouse cursor behind an element or does the mouse cursor have an z-index?

妖精的绣舞 提交于 2019-12-04 12:22:24
I would like to replace the mouse cursor with an custom image when the mouse hovers over a certain element. I do it by setting the mouse curser off first with cursor: none; when it hovers the element. Then I read out the cursor position on the hovered element and set the css position of a graphic to the cursor position with a slight offset, so that the mouse curser is not over the graphic but still over the hover area. I made a fiddle here: http://jsfiddle.net/TimG/6XeWK/ Now it works quiet allright. The problem is just when you move the mouse very fast, the mouse cursor leaves the hover area