mouse

Mouseover in Pygame

谁说我不能喝 提交于 2019-12-08 02:14:24
问题 I know this title sounds a lot like Detect mouseover an image in Pygame but there's an error. I've tried following both answers from that question, but it never worked. Here is a part of my code: title = font3.render(('SQUASH!'), True, white) play = font1.render(('PLAY'), True, white) while True: for event in pygame.event.get(): if event.type == QUIT: pygame.quit() sys.exit() screen.blit((title), (400, 400)) screen.blit(play, (theposition)) if play.collide_point(pygame.mouse.get_pos()): hi =

Best practices for creating both mouse and touch-oriented WPF application [closed]

人走茶凉 提交于 2019-12-08 01:38:56
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . There is a need to develop WPF application which will support both mouse and touch input. I'm looking for an approach that will enable

Is there any general interfaces on linux to simulate mouse movements and click?

点点圈 提交于 2019-12-08 01:32:13
问题 I have referred to a lot of tutorials on how to control your mouse cursor's movements and clicks by map these events to your own real mouse, but I noticed that everytime I must associate this mouse to one specified event in /dev/input/, if I didn't connect one real mouse, or if the linux didn't give the right event number on this real mouse, the program will definitely fail. Now I need to write a generalized program which can make one complete virtual mouse on linux, that is to say, this

Trying to change Windows mouse cursor icon from java through jni call

假如想象 提交于 2019-12-08 00:04:50
问题 In my java application, i m trying to change the mouse cursor with an argb 32bit bmp file with transparency. I want to make a jni call to change it from Windows because changing the cursor in java gives me a really bad mouse cursor (all the transparency is either 0x00 or 0xFF) At the moment i'm trying to use the function SetClassLong with as parameters: the hWnd from java (i got it following that method http://download.oracle.com/javase/1.3/docs/guide/awt/AWT_Native_Interface.html ) GCL

Dragging JPanel

我的梦境 提交于 2019-12-07 19:16:09
问题 I've got a problem when trying to drag a JPanel. If I implement it purely in MouseDragged as: public void mouseDragged(MouseEvent me) { me.getSource().setLocation(me.getX(), me.getY()); } I get a weird effect of the moved object bouncing between two positions all the time (generating more "dragged" events). If I do it in the way described in this post, but with: public void mouseDragged(MouseEvent me) { if (draggedElement == null) return; me.translatePoint(this.draggedXAdjust, this

What's the difference between using Cursor.Position, SetCursorPos(), SendInput() and mouse_event()?

有些话、适合烂在心里 提交于 2019-12-07 18:43:10
问题 Cursor.Position, SetCursorPos(), SendInput() and mouse_event() all set the mouse position to a specified coordinate. So what's the difference between them? 回答1: Cursor.Position and SetCursorPos can only be used to change the cursor position. Cursor.Position is Windows Forms; SetCursorPos is Win32. SendInput and mouse_event can be used to change the cursor position as well as generate mouse clicks and mouse wheel events. SendInput is the current API; in addition to generating mouse events, it

Cocoa - Capturing NSStatusItem mouse hover event

血红的双手。 提交于 2019-12-07 18:23:29
问题 How do I execute a function when a user's mouse hovers over my NSStatusItem? 回答1: If you assign a custom NSView to your NSStatusItem 's view property, you can override the NSResponder methods mouseEntered: , mouseMoved: and mouseExited: . 来源: https://stackoverflow.com/questions/5114974/cocoa-capturing-nsstatusitem-mouse-hover-event

How to create Paint-like app with XNA?

≯℡__Kan透↙ 提交于 2019-12-07 16:31:18
问题 The issue of programmatically drawing lines using XNA has been covered here. However, I want to allow a user to draw on a canvas as one would with a drawing app such as MS Paint. This of course requires each x and/or y coordinate change in the mouse pointer position to result in another "dot" of the line being drawn on the canvas in the crayon color in real time. In the mouse move event, what XNA API considerations come into play in order to draw the line point by point? Literally, of course,

How to drag and move winform using mouse

旧街凉风 提交于 2019-12-07 15:51:51
问题 I know how to 'drag and move' a winform by adding following code Protected Overrides Sub WndProc(ByRef m As Message) If (((m.Msg = 163) And ClientRectangle.Contains(PointToClient(New Point(m.LParam.ToInt32)))) And (m.WParam.ToInt32 = 2)) Then m.WParam = CType(1, IntPtr) End If MyBase.WndProc(m) If ((m.Msg = 132) And (m.Result.ToInt32 = 1)) Then m.Result = CType(2, IntPtr) End If End Sub But after a panel being added to winform, I can not 'drag and move' the winform within that panel area. Any

Detect mouse click location within canvas

笑着哭i 提交于 2019-12-07 15:16:37
问题 I'm having a real issue trying to define a function for where I click on empty space. So far I have managed to define where I click on an object - of which there are 10 - but now I need a separate function for when I am not clicking on any of the objects. The general idea can be found at http://deciballs.co.uk/experience.html. The objects are the rings. My code is below... Any ideas? var shapeObj = function (context, canvas, settingsBox, radius) { this.ctx = context; this.canvas = canvas;