|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to Move Mouse to Control with FocusHi,
I have win app in which I need to move the mouse to the textbox field that has the focus and then hide the mouse pointer. Any tips on how to do these two things would be appreciated. Thanks, Michael Murphy Michael D Murphy wrote:
> I have win app in which I need to move the mouse to the textbox field If you're really sure you want to do that, bearing in mind it may irritate> that has the focus and then hide the mouse pointer. your users, you can do it as follows. To move the mouse cursor to the control that has focus: Windows.Forms.Cursor.Position = _ Me.ActiveControl.PointToScreen(New Point(0, 0)) This will put the cursor at the exact top/left of the control. If you change the (0,0) to different numbers, this will offset the cursor from that position. To hide the cursor: Windows.Forms.Cursor.Hide() This will hide it as long as it remains over your application; if the pointer is moved over a different application it will still appear. Hope that helps, -- (O) e n o n e (O) e n o n e,
Thanks for your help. This is a kiosk type XP Embedded Win App that offers the user no mouse or keyboard interaction. But I did tie a real push button on the front panel so the user can print a coupon for what he/she is looking at. Kinda complex to explain, but thanks again for the code snippet!! Michael Show quoteHide quote "Oenone" <oen***@nowhere.com> wrote in message news:X_g5e.11829$S9.5623@newsfe5-gui.ntli.net... > Michael D Murphy wrote: >> I have win app in which I need to move the mouse to the textbox field >> that has the focus and then hide the mouse pointer. > > If you're really sure you want to do that, bearing in mind it may irritate > your users, you can do it as follows. > > To move the mouse cursor to the control that has focus: > > Windows.Forms.Cursor.Position = _ > Me.ActiveControl.PointToScreen(New Point(0, 0)) > > This will put the cursor at the exact top/left of the control. If you > change > the (0,0) to different numbers, this will offset the cursor from that > position. > > To hide the cursor: > > Windows.Forms.Cursor.Hide() > > This will hide it as long as it remains over your application; if the > pointer is moved over a different application it will still appear. > > Hope that helps, > > -- > > (O) e n o n e > > (O) e n o n e
When I am debugging : Windows.Forms.Cursor.Position = Me.ActiveControl.PointToScreen(New Point(0, 0)) I get an Object Not Set to a reference Exception, even though I have the following line of code right above it. txtParkHere.Focus() Obviously I am doing something wrong. When I look at the value of ActiveControl, it is set to Nothing. Thanks for your time. Michael Show quoteHide quote "Michael D Murphy" <mdmur***@scs-techresources.com> wrote in message news:efr$MP7OFHA.3880@tk2msftngp13.phx.gbl... > (O) e n o n e, > Thanks for your help. > This is a kiosk type XP Embedded Win App that offers the user no mouse or > keyboard interaction. But I did tie a real push button on the front panel > so the user can print a coupon for what he/she is looking at. Kinda > complex to explain, but thanks again for the code snippet!! > Michael > "Oenone" <oen***@nowhere.com> wrote in message > news:X_g5e.11829$S9.5623@newsfe5-gui.ntli.net... >> Michael D Murphy wrote: >>> I have win app in which I need to move the mouse to the textbox field >>> that has the focus and then hide the mouse pointer. >> >> If you're really sure you want to do that, bearing in mind it may >> irritate >> your users, you can do it as follows. >> >> To move the mouse cursor to the control that has focus: >> >> Windows.Forms.Cursor.Position = _ >> Me.ActiveControl.PointToScreen(New Point(0, 0)) >> >> This will put the cursor at the exact top/left of the control. If you >> change >> the (0,0) to different numbers, this will offset the cursor from that >> position. >> >> To hide the cursor: >> >> Windows.Forms.Cursor.Hide() >> >> This will hide it as long as it remains over your application; if the >> pointer is moved over a different application it will still appear. >> >> Hope that helps, >> >> -- >> >> (O) e n o n e >> >> > > Well, never mind, I see I should be using the txtParkHere.Select() method.
Thanks Again. Michael Show quoteHide quote "Michael D Murphy" <mdmur***@scs-techresources.com> wrote in message news:%23Pshaw7OFHA.1176@TK2MSFTNGP12.phx.gbl... > (O) e n o n e > When I am debugging : > Windows.Forms.Cursor.Position = Me.ActiveControl.PointToScreen(New > Point(0, 0)) > > I get an Object Not Set to a reference Exception, even though I have the > following line of code right above it. > txtParkHere.Focus() > > Obviously I am doing something wrong. When I look at the value of > ActiveControl, it is set to Nothing. > Thanks for your time. > Michael > > "Michael D Murphy" <mdmur***@scs-techresources.com> wrote in message > news:efr$MP7OFHA.3880@tk2msftngp13.phx.gbl... >> (O) e n o n e, >> Thanks for your help. >> This is a kiosk type XP Embedded Win App that offers the user no mouse or >> keyboard interaction. But I did tie a real push button on the front panel >> so the user can print a coupon for what he/she is looking at. Kinda >> complex to explain, but thanks again for the code snippet!! >> Michael >> "Oenone" <oen***@nowhere.com> wrote in message >> news:X_g5e.11829$S9.5623@newsfe5-gui.ntli.net... >>> Michael D Murphy wrote: >>>> I have win app in which I need to move the mouse to the textbox field >>>> that has the focus and then hide the mouse pointer. >>> >>> If you're really sure you want to do that, bearing in mind it may >>> irritate >>> your users, you can do it as follows. >>> >>> To move the mouse cursor to the control that has focus: >>> >>> Windows.Forms.Cursor.Position = _ >>> Me.ActiveControl.PointToScreen(New Point(0, 0)) >>> >>> This will put the cursor at the exact top/left of the control. If you >>> change >>> the (0,0) to different numbers, this will offset the cursor from that >>> position. >>> >>> To hide the cursor: >>> >>> Windows.Forms.Cursor.Hide() >>> >>> This will hide it as long as it remains over your application; if the >>> pointer is moved over a different application it will still appear. >>> >>> Hope that helps, >>> >>> -- >>> >>> (O) e n o n e >>> >>> >> >> > >
Reading Output from Shell Command
Help with some code? for loop ending condition Writing TIF to database open binary file and search hex string Problems with the excel find function in vb.net Dataview Find method, case insensitive? Remote debugging: Unable to map the debug start page URL to a machine name Moving a windows form from a windows app to a class library. XMLReader and VB.Net |
|||||||||||||||||||||||