Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mouse Events mess up in my activeX control in VB

Status
Not open for further replies.

snorkle

Programmer
Apr 10, 2001
16
US


Can anyone please explain why my ActiveX control messes up the mouse events?

I'm using visual basic.

Here's what I did:

1. Start new Standard EXE project
2. Add a usercontrol to the project
3. On the usercontrol, i pasted a picturebox in the upper-left hand corner.
4: Added this code to the control:

'***************************
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Static b As Boolean
b = Not b
If b Then
Picture1.BackColor = &HFFFFFF
Else
Picture1.BackColor = &H8000000F
End If
End Sub
Private Sub UserControl_Resize()
Picture1.Width = UserControl.Width
Picture1.Height = UserControl.Height
End Sub
'*****************


5. Then I closed the usercontrol window.
6. I added my control to form1. When i resize it, it should take form to the size i make, which it does.

7. Started the program.
8. Whenever I first click on my control, it changes the color on and off, as expected. then when i click on the rest of the form, it still goes on and off. When i click on any of visual basic Ide, it goes on and off...?? why?


I'm new to this message board, so i don't know how to put my project files here. but that should be enough.


thanx in advance :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top