The programming of cursors in VB6 and vb.net

Source: Internet
Author: User
Tags integer
Programming

Using APIs to program the cursor in VB6:

Option explicitprivate Type pointapi    X as long    Y as Longend typeprivate Declare Functi On GetCursorPos Lib "user32" (Lppoint as Pointapi) as Longprivate Declare Function showcursor Lib "user32" (ByVal bshow as Long) as Longpublic Function Getxcursorpos () as long   Dim pt as pointapi   GetCursorPos Pt &nbs P Getxcursorpos = Pt. Xend functionpublic Function Getycursorpos () as long   Dim pt as pointapi   GetCursorPos Pt &nbs P Getycursorpos = Pt. Yend Function ' Gets the position of the cursor in the screen private Sub form_mousemove (Button As Integer, Shift As Integer, X as single, Y as single)  & nbsp;  Label1.Caption = "X screen Position =" & getxcursorpos    label2.caption = "Y screen posit Ion =  "& Getycursorposend Sub ' hidden cursor private Sub Command1_Click ()     showcursor FalseEnd Sub ' show cursor private Sub Command2_Click ()     showcursor TrueEnd sub  

' Hide cursor Private Sub button1_click (ByVal sender as System.Object, ByVal e as System.EventArgs) Handles Button1.Click Cursor.hide () End Sub ' Gets the position of the cursor in the screen Private Sub form2_mousemove (ByVal sender as Object, ByVal e as System.window        S.forms.mouseeventargs) Handles Mybase.mousemove Me.Label1.Text = "X screen Position =" & cursor.position.x Me.Label2.Text = "Y screen Position =" & Cursor.position.y End Sub "displays cursor Private Sub button2_click (Byva L sender as System.Object ByVal e as System.EventArgs) Handles Button2.click cursor.show () End Sub

Very simple things, more examples, can refer to API manuals and framework documentation.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.