mouse

How to drag and move winform using mouse

删除回忆录丶 提交于 2019-12-06 03:46:52
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 idea of how to 'drag and move' within a panel? I mean the mouse point, click, hold and move within

Detect user scroll attempt when overflow is hidden

a 夏天 提交于 2019-12-06 03:44:10
问题 "scroll" does not fire when content is overflow: hidden . "wheel" fires for wheel mouses but not on a magic trackpad or magic mouse. How can I detect the mouse interaction of attempting to scroll in this scenario? 回答1: You can get the mouse coordinates and other properties like movement easily. Using that position you can choose when trigger an wheel event or just make the script to scroll the page. check this fiddle (not mine) to get inspired 来源: https://stackoverflow.com/questions/32512924

jQuery move divs according to mouse position

别说谁变了你拦得住时间么 提交于 2019-12-06 03:31:40
I got a little Problem with jQuery, maybe you guys can help me. Here's the HTML Markup in jfiddle for better understanding: jsfiddle I'd like to have the div called #move_me to move either to the right or to the left side within the #content_wrapper according to the mouse position inside #content_wrapper . Basically what I want is: if I move my cursor inside the #content_wrapper div to the right then the #move_me div should move to the left to see content2 div, when I move to the left the #move_me div should move to the right to see content1 div.. I tried to get it to work with mousemove and

Detect mouse click location within canvas

一笑奈何 提交于 2019-12-06 03:23:31
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; this.sBox = settingsBox; this.frequencies = new Array(220, 440, 1024, 2048); this.cols = new Array(255,

QML - MouseArea/MouseEvent issue

别说谁变了你拦得住时间么 提交于 2019-12-06 03:01:44
The following piece of code generates a white rectangle containing a red rectangle and a grey rectangle. Every rectangle has an associated MouseArea. The grey rectangle becomes blue when the mouse is clicked inside it. The red rectangle prints a console message when the mouse cursor enters inside it and another message when the released signal is emitted. I would like to: press and hold the mouse button inside the grey rectangle (becoming blue) move the cursor outside the grey/blue rectangle and then inside the red rectangle, without releasing the button and capturing the entered signal of the

How to set mouse cursor on X11 in a C application

与世无争的帅哥 提交于 2019-12-06 02:58:01
I've got a rather large and rather old C application that has been ported to Linux. I'm in charge of getting mouse cursors to work correctly, but having some issues. I was able to convert most of the cursors we require to using the standard cursors provided by XFontCursor by using something like: gCursorTable[waitCurs] = XCreateFontCursor(gDisplay, XC_watch); ... XDefineCursor(gDisplay, WHostWindow(w), gCursorTable[cursor]); XFlush(gDisplay); This is fine for cursors which have analogs in the extremely limited list of (useful) cursors that XFontCursor provides, but there are other built in

How to get the coordinates of an image mouse click in the event handler?

為{幸葍}努か 提交于 2019-12-06 02:41:10
In the following WPF app, I have an Image in a ContentControl . When the user clicks on the image , how can I get the x/y coordinates of where the mouse clicked on the image? XAML: <Window x:Class="TestClick828374.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <StackPanel Margin="10"> <ContentControl Content="{Binding TheImage}" MouseDown="ContentControl_MouseDown"/> </StackPanel> </Window> Code-Behind: using System; using System.Windows; using System.Windows.Controls;

How to simulate keyboard and mouse events using CGEventPost in login window mac OS?

谁说我不能喝 提交于 2019-12-06 01:51:29
问题 I have created a pre-login agent which uses CGEventPost for simulating keyboard. FYI I am developing a remote control app similar to teamviewer. Keyboard CGEventRef keyEvent = CGEventCreateKeyboardEvent( NULL, keyCode, down ) ; CGEventPost( kCGHIDEventTap, keyEvent ) ; CFRelease( keyEvent ) ; Mouse CGEventRef event = CGEventCreateMouseEvent(eventSource, eventType, mouseLocation, mouseButton ); CGEventPost(kCGHIDEventTap, event); CFRelease(event); Pre-login launch agent <?xml version="1.0"

Mouse right click on Firefox triggers click event

妖精的绣舞 提交于 2019-12-06 01:45:00
I noticed that the mouse right click on Firefox triggers an addEventListener. I tried this code on more browsers and more OS (IE 11-10-9, Safari, Chrome) and by pressing the mouse right click, only on Firefox the console.log message is always printed. <div id="one-div" style="height:400px;width:500px;background-color:#000;"> click me </div> <script> function cb(event, from){ // if click is fired on <div> with: // left click, both EventListener will be printed. // right click, only the 'document' one will be printed. event.preventDefault(); console.log(event + ' from: ' + from ); } document

javascript simulate mouse click on specific position

末鹿安然 提交于 2019-12-06 00:41:37
I need to now how to fire a mouse click event on a button automatically. I have this but doesn't work :( window.setInterval(function() { simulateClick(); }, 2000); function simulateClick() { var evt = document.createEvent("MouseEvents"); evt.initMouseEvent("click", false, false, window, 0, 684, 571, 684, 508, false, false, false, false, 0, null); var a; a.dispatchEvent(evt); } Thanks in advance Oscar If all you want to do is click a button, button elements have a click method that can be invoked: <input type="button" id="theButton" onclick="javascript:alert('The button was clicked!');" value=