Results 1 to 2 of 2

Thread: [RESOLVED] picture_mouseMove

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2006
    Posts
    120

    Resolved [RESOLVED] picture_mouseMove

    i need the picture1_mousemove function only when i click the mnuFileList(index=1), not function when load the form.so, how to improve code below.

    VB Code:
    1. Private Sub mnuFileList_Click(Index As Integer)
    2.     If Index = 1 Then
    3.         CommonDialog1.ShowOpen
    4.         Picture1.Picture = LoadPicture(CommonDialog1.FileName)
    5.     ElseIf Index = 2 Then
    6.         Unload Me
    7.     End If
    8. End Sub
    9.  
    10. Private Sub picture1_mousemove(button As Integer, shift As Integer, X As Single, Y As Single)
    11.     Text5.Text = X
    12.     Text6.Text = Y
    13. End Sub

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: picture_mouseMove

    You can set the boolean flag:
    VB Code:
    1. Option Explicit
    2.  
    3. [COLOR=Red]Dim blnOkToMove As Boolean[/COLOR]
    4.  
    5. Private Sub Form_Load()
    6.     [COLOR=Red]blnOkToMove = False[/COLOR]
    7. End Sub
    8.  
    9. Private Sub mnuFileList_Click(Index As Integer)
    10.     If Index = 1 Then
    11.         CommonDialog1.ShowOpen
    12.         Picture1.Picture = LoadPicture(CommonDialog1.FileName)
    13.         [COLOR=Red]blnOkToMove = True[/COLOR]
    14.     ElseIf Index = 2 Then
    15.         Unload Me
    16.     End If
    17. End Sub
    18.  
    19. Private Sub picture1_mousemove(button As Integer, shift As Integer, X As Single, Y As Single)
    20.     [COLOR=Red]If Not blnOkToMove Then Exit Sub[/COLOR]
    21.     Text5.Text = X
    22.     Text6.Text = Y
    23. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width