-
Class Object Events
Hi
I made a class that selects an area with a rubberband. This gives me the left and top and the right and bottom to work with. My problem is once I get this info I want this area to live on it's own with events such as myArea_click(x as single,y as single). How do I create and get this type of event to completely ignore the button down event of the form without using a conditional in the button down event.
In other words - How do I make this area a completely independent object such as a picturebox?
-
Is this fact?
Thanks but I can't accept that. :) There is always a way. Even if I gotta jump through hoops and stand on my ear I wanna know how I can make this happen. Anyone?
-
You COULD create a child window of the form or picture box, using pure API, and write a message handling function, but then you simply delegate the need to loop (to find the correct event to run) to a Window Message Procedure. You would also have to add functionality to Blt the area being covered by the new window to the window to make it seamless.
You could also create a custom control, instead of a class. This would be about the same amount of work as the method I first put forward, and much easier then the second, but you seemed to want a class...
Z.
-
For the click event, you could (possibly) find the form's RECT, get the top and left of your "area", and make a rectangle out of it's width, offsetting it from the left and top of the form. Then, you can check to see if the mouse is in your area when you check it.
-
That was my first Idea =). He didnt like it though.
Z.
-
Thanks for all the help. Looks like it's going to be a usercontrol then. I only thought class so I could have code in one place. Control will give me events I need too outside of main code.
Question: Will I get the same performance using a user control as I would if the code were all in one big spegetti app?
-
I think it would be slower if you had it in an OCX (i think).
-
OCX = Class.
At least in practice. Both end up as COM objects, the only real difference is that an OCX is a separate component.
Z.