Page 1 of 1

MouseMove

Posted: Fri Feb 12, 2016 10:36 am
by nirmalks
Hello,

Need a little help on this code:

IF ($_.Button -eq 'Left')
{

$CurTopNow = $panel259.Top
$CurLeftNow = $panel259.Left

$panel259.Top = [System.Windows.Forms.Cursor]::Position.X + $CurTopNow
$panel259.Left = [System.Windows.Forms.Cursor]::Position.Y + $CurLeftNow

}

I have a panel on a form that I'd like to move. So far I've tried above code, but can't determine as to what to add in MouseMove event so it moves smoothly.

Thanks heaps!
Nirmal

Re: MouseMove

Posted: Fri Feb 12, 2016 10:39 am
by DevinL
[POST MOVED TO POWERSHELL GUI FORUM BY MODERATOR]

Re: MouseMove

Posted: Fri Feb 12, 2016 11:01 am
by jvierra
Here is an example of how to use the event. You need to establish capture and dragging states.
http://www.codeproject.com/Articles/318 ... at-runtime

Re: MouseMove

Posted: Fri Feb 12, 2016 3:01 pm
by jvierra
Here is a PowerShell Studio demo of moving a control with the mouse;

Re: MouseMove

Posted: Fri Feb 12, 2016 3:16 pm
by jvierra
Demo of movable controls a circular button.