mouse

VB.NET - Mouse Coordinates

纵饮孤独 提交于 2019-12-02 09:35:56
问题 I have a vb.net application, and I want to know how to find the coordinates of the pointer (mouse) when it is clicked on the form. Not much else to say, so I'll leave it like that.. :D Thanks 回答1: Very simple code to put the mouse coords in a text box Private Sub Form1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseClick Dim MPx As Point = MousePosition() TextBox1.Text = MPx.ToString End Sub tried and tested, 回答2: I believe you are looking

Detecting a Mouse Click Anywhere on Screen with Java

匆匆过客 提交于 2019-12-02 09:19:53
Is it possible to detect a mouse click anywhere on a screen, outside of my application? I have written an application to do this in C#, but would like to write a version of this in Java so that it can be run on several platforms. It looks like I can get the co-ordinates of the mouse at any time with java.awt.MouseInfo.getPointerInfo() but I am not sure as to how to listen for a mouse click. In C# I used GetAsyncKeyState to detect whether the mouse button was clicked, but obviously I cannot use this if I wish to keep this "clean" for use in multiple platforms. You can do this only with platform

GetMouseMovePointsEx: Bounds / MOUSEMOVEPOINT in (mp_in) problems

廉价感情. 提交于 2019-12-02 09:05:05
I'm trying to calculate cursor acceleration / velocity. I read Find the velocity of the mouse in C# and decided to take Hans's suggestion of using GetMouseMovePointsEx ( pinvoke.net , MSDN ). I made a demo program to test it out (see full code below) but it has a big limitation. It won't return points once the cursor leaves the window. In fact, the function returns -1 (win32Exception 1171, "The point passed to GetMouseMovePoints is not in the buffer") if execution isn't limited to points within the MainWindow. I suspect this may be because I'm using Mouse.GetPosition() to provide the mp_in

How to Move the mouse using VBScript

点点圈 提交于 2019-12-02 07:22:22
问题 I am trying to move the mouse using VBScript. I tried to use Sendkeys "{CLICK LEFT , x , y}" and Sendkeys "{MOVETO, 10 , 20}" but it isn't working i also tried to use MouseKeys, so i could move it with the keyboard and therefore use Sendkeys to activate it but it also did not work (the mousekeys numpad is not moving the mouse). I've tried everything I know and what i could research elsewhere, so now I hope one of you can answer this for me. thxs 回答1: VBScript can't do this natively. You'd

Changing value of boolean when mouse cursor hovers over a JButton

允我心安 提交于 2019-12-02 07:10:01
I have a button that will change from black to gray when you hover over, I do this with setRolloverIcon(ImageIcon); . Is there any easy way to make a boolean equals to true while the mouse cursor hovers over the JButton or would I have to use a MouseMotionListener to check the position of the mouse cursor? Is there any easy way to make a boolean equals to true while the mouse cursor hovers over the JButton you can to add ChangeListener to ButtonModel , e.g. JButton.getModel().addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { ButtonModel model =

Why is a camera rotated around z-axis in Unity3D?

怎甘沉沦 提交于 2019-12-02 05:27:38
问题 I have a main camera in Unity3D that I want to rotate depending on mouse input, so it works as a first person video-game where you move the mouse depending on where do you want to look at. The starting values of the camera (Transform tab in Inspector tab in Unity) are: Position : X = -1, Y = 1, Z = -11. Rotation : X = 0, Y = 0, Z = 0. Scale : X = 1, Y = 1, Z = 1. I added a Script component for the Main Camera. And it is the following class: using UnityEngine; using System.Collections; public

Move the player in the position of the mouse in pygame

一笑奈何 提交于 2019-12-02 05:12:13
I have a fixed player in center of the screen and for now I'm moving the background and the elements in the opposite direction to give the illusion of moving forward with the directional keys. But now, I want to detect the position of the mouse and deplace the player in the direction of the mouse (as in the game agar.io for example) and that the acceleration depends on the distance with the object (the further the mouse is, the faster the player moves forward and if the mouse is on the player,he does not advance anymore) My program work like this : keys = pygame.key.get_pressed() if keys

Restrict mouse movement over a specified window handle

北慕城南 提交于 2019-12-02 05:01:41
问题 I'm looking to simulate a kiosk mode for Safari on Windows. OSX will not work with my input hardware and Chrome's GPU acceleration is too slow for the machine I'm using. The only plausible solution [so far] is to run Safari and send an F11 (fullscreen) keystroke, but prevent the URL bar from expanding when the mouse reaches the top pixels of the screen. I've looked and can't seem to find any good solution and would like to know if I can restrict the cursor movement from reaching the top pixel

Java Read Raw Mouse Input

你离开我真会死。 提交于 2019-12-02 05:01:12
I'm looking for a way in Java to read in raw mouse input and not just the event listeners. I'll tell you what I'm doing. Essentially, there is a game where if you move the mouse to the right, I want Java to send key signals of the 'd' key being pushed down, and when the mouse is moved to the left, the 'a' key being held down. But, when you move the mouse, the game quickly corrects the mouse position and sends it right back into the middle of the screen. So, if you use mouse listener, you get one event of the mouse being moved to the right, then another quickly following of the mouse being move

Swing Timer stops calling actionPerformed() while the mouse is moving inside a JFrame

痴心易碎 提交于 2019-12-02 03:38:41
If I move my mouse inside a javax.swing.JFrame , the javax.swing.Timer stops calling the actionPerformed() method until the mouse stops moving. It only occurs when I move the cursor with my Rocket Kone XTD mouse. When I use my trackpad everything is fine. How can I fix it? I'm using macOS Sierra. Here's my code: import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.Timer; public class Mouse { public static void main(String[] args) { JFrame frame = new JFrame(); frame.setSize(500, 500); frame.setVisible(true); Timer timer = new