mouse

C# moving the mouse around realistically

时光总嘲笑我的痴心妄想 提交于 2019-11-27 12:31:05
I am demoing a piece of software and want to build a mouse 'mover' function so that I can basically automate the process. I want to create realistic mouse movements but am having a bit of a mental block in the thought process. I can move a mouse around easily with c# but want it to be a bit more realistic than just the cursor appearing at a certain x, y, coordinates and then pressing a button. I get the current position of the mouse and then get the end point. Calculate an arc between the two points, but then I need to calculate points along that arc so that I can add a timer event into that

Determine mouse position outside of events (using jQuery)?

*爱你&永不变心* 提交于 2019-11-27 12:02:40
I need to get a hold of the absolute mouse position / coordinates (X and Y) using (preferably) jQuery like in this tutorial but outside of any JavaScript event. Thank you. Not possible. You can however use the same approach in the tutorial to store the position in a global variable and read it outside the event. Like this: jQuery(document).ready(function(){ $().mousemove(function(e){ window.mouseXPos = e.pageX; window.mouseYPos = e.pageY; }); }) You can now use window.mouseXPos and window.mouseYPos from anywhere. eyelidlessness This started as a comment on Chetan Sastry's answer , but I

How to create MS Paint clone with Python and pygame

与世无争的帅哥 提交于 2019-11-27 11:34:21
问题 As I see it, there are two ways to handle mouse events to draw a picture. The first is to detect when the mouse moves and draw a line to where the mouse is, shown here. However, the problem with this is that with a large brush size, many gaps appear between each "line" that is not straight since it is using the line's stroke size to create thick lines. The other way is to draw circles when the mouse moves as is shown here. The problem with this is that gaps appear between each circle if the

How can I set the mouse position in a tkinter window

陌路散爱 提交于 2019-11-27 09:41:49
I have a 3d rendering program that rotates the world around an observer based on the position the mouse is on the screen. The amount in radians that the world is rotated is defined by this line glob.worldx=-(w.winfo_pointerxy()[0]-xy[0])/250 Where xy[0] is the x coordinate of the center of the screen This means that the amount that the observers field of view can be rotated is limited by the distance the mouse can go. If I could get the mouse to come back to the center of the screen I could solve this problem. Any ideas? The good news is that there is a way to do it. The intermediate news is

SetWindowsHookEx for WH_MOUSE

耗尽温柔 提交于 2019-11-27 09:19:52
I've got some code into my hands that prints coordinates of the mouse globally (using WH_MOUSE_LL). My target is to use WH_MOUSE instead of WH_MOUSE_LL because (from what I've read) it is faster. I've read over the forum that when using WH_MOUSE it needs to be declared in DLL to achieve global effect, but still, when used in the program it should work over that application where it was declared, but it doesn't work (it prints nothing) when I just change the WH_MOUSE_LL to WH_MOUSE. This is the code: #define _WIN32_WINNT 0x0400 #pragma comment( lib, "user32.lib" ) #include <windows.h> #include

java - Detect Mouse Clicks Anywhere On Screen

醉酒当歌 提交于 2019-11-27 08:33:07
问题 I want my app to detect mouse clicks anywhere on the screen without having to have the app focused. I want it to detect mouse events universally even if its minimized. So far I've only been able to detect mouse events within a swing gui. Autohotkey can detect mouse clicks and get the mouse's position at any time, how can I do this with java? 回答1: It is possible with a little trick. Should be 100% cross-platform (tested on Linux & Windows). Basically, you create a small JWindow, make it

How to get Touchscreen to use Mouse Events instead of Touch Events in C# app

六月ゝ 毕业季﹏ 提交于 2019-11-27 08:22:56
问题 I have developed a C# app that overrides the PreviewMouseUp, PreviewMouseMove, and PreviewMouseDown events in some custom controls to allow scrolling a scroll viewer by clicking and dragging. This custom code works great on non-touch screens when the mouse is used to drag and scroll, but when I use it on a real touch screen monitor it fails to work because the PreviewMouseUp does not get fired when the monitor is touched and dragged with a finger. I want to be able to use my existing code

Adding a custom cursor in XNA/C#?

夙愿已清 提交于 2019-11-27 08:01:37
问题 I am currently developing a game in XNA. I would like to add a cursor (not the standard Windows one)to the game. I have already added the sprite to my contents folder. I have a method for finding the position of the mouse, but I don't know how I should go about displaying the cursor in the window. Here is the method I am using to find the position of the mouse (I instantiated a "MouseState" class in the beginning of the Game1 class): public int[] getCursorPos() { cursorX = mouseState.X;

Listen to JFrame resize events as the user drags their mouse?

蓝咒 提交于 2019-11-27 07:58:55
When a user clicks on the corner of a JFrame to resize and drags the mouse around, the JFrame redraws based on the current position of the mouse as the user drags. How can you listen to these events? Below is the what I have currently tried: public final class TestFrame extends JFrame { public TestFrame() { this.addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { // This is only called when the user releases the mouse button. System.out.println("componentResized"); } }); } // These methods do not appear to be called at all when a JFrame // is being

How to Set mouse cursor position to a specified point on screen in C#?

北城余情 提交于 2019-11-27 07:55:52
问题 How to Set mouse cursor position to a specified point on screen in C#? am i must hacke the motherboard buffer that receive the mouse and keyboard coordinates and presses ??? is there another one to do clicks or i am imagine ??? 回答1: The following will set the mouse position and perform a click: public static void ClickSomePoint() { // Set the cursor position System.Windows.Forms.Cursor.Position = new Point(20, 35); DoClickMouse(0x2); // Left mouse button down DoClickMouse(0x4); // Left mouse