Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42225

VS 2010 [RESOLVED] Mouse input for input box re: Picture Coordinates

$
0
0
Hi all! I'm having an issue and so I turn to the geniuses for help :)

What I'm trying to do:
I'm trying to have users be able to click a button, which then allows the user to click the top left corner of a portion in a picture followed by the lower right corner of a portion of the picture. When they click I am looking for the XY coordinates of the picture to be saved in a specific box.

What I have:
I have some working code that will save picture coordinates upon clicking. I was using it to prefill some 'test' boxes as a proof of concept and it worked beautifully. I'm trying to make this more user friendly so I copied the same code over to a slightly different mechanism and it obviously hit the fan because it isn't designed for what I moved it to. I've attached a picture of the interface with the general directions/hopes of what I'm trying to accomplish.Attachment 94675

And the code I ported over:
Code:

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        LocalMousePosition = Question1preview.PointToClient(Cursor.Position)

        On Error GoTo errbox


        lASStatus.Text = "Click on the UPPER LEFT CORNER of choice 1."
        tQ1C1X1.Text = LocalMousePosition.X
        tQ1C1Y1.Text = LocalMousePosition.Y

        lASStatus.Text = "Click on the LOWER RIGHT CORNER of choice 1."
        tQ1C1X2.Text = LocalMousePosition.X
        tQ1C1Y2.Text = LocalMousePosition.Y

        lASStatus.Text = "Ready for Autosetting."

        GoTo endend
errbox:
        MsgBox("There was an error, please make sure you click ONLY in the preview window when using the auto-setter.", MsgBoxStyle.Critical, "Error!")
endend:
    End Sub

I totally know why and how it's failing -- it worked perfectly for my test. I just don't know how to adapt it to not be failing here.

Any assistance is greatly appreciated! Thanks !
Attached Images
 

Viewing all articles
Browse latest Browse all 42225

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>