mousedown

How to detect a mouse_down on a Userform Frame while the mouse is still down

雨燕双飞 提交于 2019-11-29 18:02:12
I want to detect when there's a mouse_down on any Frame on the Form while the mouse is still down. I know how to do it for a Click, but I want to catch it before mouse_up. Thanks You can create a _MouseDown event handler for each frame on the form, or if you have many frames you can create a generic event handler class Create a Class module (eg named cUserFormEvents ) Public WithEvents Frme As MSForms.frame Public frm As UserForm Private Sub Frme_MouseDown( _ ByVal Button As Integer, _ ByVal Shift As Integer, _ ByVal X As Single, _ ByVal Y As Single) ' Put your event code here MsgBox Frme

WPF: Canvas swallowing MouseDownEvent?

社会主义新天地 提交于 2019-11-29 15:43:44
Can anybody please explain to me why the MouseDown event is not reaching the ScrollViewer in this easy example? <Window x:Class="MouseDownTest.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> <ScrollViewer Name="scrollViewer" Background="Green" MouseDown="ScrollViewer_MouseDown" PreviewMouseDown="ScrollViewer_PreviewMouseDown"> <Canvas Name="canvas" Background="Beige" MouseDown="Canvas_MouseDown" PreviewMouseDown="Canvas_PreviewMouseDown"> </Canvas> <

How to draw and move shapes using mouse in C#

ⅰ亾dé卋堺 提交于 2019-11-29 10:16:35
问题 I'm new to programming in C# and wanted to ask for a little bit of help. I'm currently trying to move a color-filled rectangle that I draw on a Windows Application form with my left mouse button, and I'm trying to drag-and-drop it to another location using my right mouse button. Currently I've managed to draw the rectangle, but the right click is dragging the entire form along. Here's my code: public partial class Form1 : Form { private Point MouseDownLocation; public Form1() {

how to prevent focus event in IE when mousedown happens

寵の児 提交于 2019-11-29 07:12:10
event.preventDefault(); return false; event.stopPropagation(); any of them can prevent focus event from happening when I trigger a mousedown event in Firefox and chrome, but it failed in IE.In fact,chrome has another problem. when mousedowning, :hover css is not working. ` <input type="text" id="name"> <div id="suggest"> <div>mark</div> <div>sam</div> <div>john</div> </div> $("#name").focus(suggest.show).blur(suggest.hide); ` what I expected is, when I click the sub div, such as "sam",and then $("#name").val("sam"). but the problem is, when I press the mouse(just mousedown,not released), the $

JS: detect right click without jQuery (inline)

时光怂恿深爱的人放手 提交于 2019-11-28 22:03:52
I'm calling a function, that builds a table which includes several links. I want to check if a link has been clicked with right or left mouse. I tried to add the following part to the <a> hyperlink. onmousedown="function mouseDown(e){ switch (e.which) { case 1: alert('left'); break; case 2: alert('middle'); break; case 3: alert('right'); break; } }" But nothing happens If I click on a link. xdazz The html: <a href="#" onmousedown="mouseDown(event);">aaa</a>​​​​​​​​​​​​​​​​​​​​​​​​​​​ The javascript: function mouseDown(e) { e = e || window.event; switch (e.which) { case 1: alert('left'); break;

Moving a control by dragging it with the mouse in C#

旧街凉风 提交于 2019-11-28 21:26:25
I'm trying to move the control named pictureBox1 by dragging it around. The problem is, when it moves, it keeps moving from a location to another location around the mouse, but it does follow it... This is my code. and I would really appreciate it if you could help me public partial class Form1 : Form { public Form1() { InitializeComponent(); } bool selected = false; private void pictureBox1_MouseDown(object sender, MouseEventArgs e) { selected = true; } private void pictureBox1_MouseMove(object sender, MouseEventArgs e) { if (selected == true) { pictureBox1.Location = e.Location; } } private

Can't get Three.js onDocumentMouseDown to work correctly

青春壹個敷衍的年華 提交于 2019-11-28 12:39:37
问题 I've looked at a lot of examples -- and borrowed from some -- and can't seem to get this to work right. What I want is for the raycaster in onDocumentMouseDown to pick up sprites when the user clicks anywhere on the visible surface of a sprite. What I'm getting is a misaligned result, in that a sprite may be picked up if the user clicks somewhat to the right, above, or below the sprite, and will not pick it up at all if the user clicks on the left edge of the sprite. So basically something is

How to detect a mouse_down on a Userform Frame while the mouse is still down

霸气de小男生 提交于 2019-11-28 12:02:18
问题 I want to detect when there's a mouse_down on any Frame on the Form while the mouse is still down. I know how to do it for a Click, but I want to catch it before mouse_up. Thanks 回答1: You can create a _MouseDown event handler for each frame on the form, or if you have many frames you can create a generic event handler class Create a Class module (eg named cUserFormEvents ) Public WithEvents Frme As MSForms.frame Public frm As UserForm Private Sub Frme_MouseDown( _ ByVal Button As Integer, _

Why is MouseMove event firing when left mouse is clicked only for MouseDown event?

半腔热情 提交于 2019-11-28 10:40:04
问题 Either I am not totally understanding how events work or Delphi Prism has gone mad!!! I have a winform, mousedown event and mousemove event. Whenever I click the left mouse button only, MouseDown event fires as expected but ALSO MouseMove event fires right after when it is not suppose to. Here is the piece of code from my winform designer where the methods are assigned to events. self.ClientSize := new System.Drawing.Size(751, 502); self.KeyPreview := true; self.Name := 'Maker'; self.Text :=

JavaScript while mousedown

落花浮王杯 提交于 2019-11-28 00:55:51
var mdflag; var count = 0; document.addEventListener("mousedown",mdown,false); document.addEventListener("mouseup",mup,false); } function mdown() { mdflag=true; while(mdflag) document.getElementById("testdiv").innerHTML = count++; } function mup() { mdflag = false; } I'm wanting to run code while the mouse is down, i cant find anything to suggest i can do while(mousedown) so i've tryed making a flag for mousedown which is reset on mouse up however i beleive the while loop is whats causing me to go get stuck in an infinite loop. Any advice to help with what i'm trying to acheive? You have to