Getting an object location
-
Is there a way to tell if an object, like a button, has been moved into a container like a group box or a panel. (this is the running app, not in the IDE) The method of moving would be using the MouseMove event with the button object and I was looking to see if there was an easier way than to use the x,y of the object to see if something was in the container after dragging it.
"Details details. Things to do Things to get done. Don't bother me with details just tell me when they're done." James Price
-
Is there a way to tell if an object, like a button, has been moved into a container like a group box or a panel. (this is the running app, not in the IDE) The method of moving would be using the MouseMove event with the button object and I was looking to see if there was an easier way than to use the x,y of the object to see if something was in the container after dragging it.
"Details details. Things to do Things to get done. Don't bother me with details just tell me when they're done." James Price
Have you looked at the Parent property of the control? That should give you the container of the control.
Tech, life, family, faith: Give me a visit. I'm currently blogging about: Funny Love The apostle Paul, modernly speaking: Epistles of Paul Judah Himango
-
Have you looked at the Parent property of the control? That should give you the container of the control.
Tech, life, family, faith: Give me a visit. I'm currently blogging about: Funny Love The apostle Paul, modernly speaking: Epistles of Paul Judah Himango
When I look at the .Parent of the current moving control, it is still showing my form as the parent. I am not implicitly setting a new parent but I would not be able to do that because i wouldnt know what to set it to and run into the same issue.
"Details details. Things to do Things to get done. Don't bother me with details just tell me when they're done." James Price
-
When I look at the .Parent of the current moving control, it is still showing my form as the parent. I am not implicitly setting a new parent but I would not be able to do that because i wouldnt know what to set it to and run into the same issue.
"Details details. Things to do Things to get done. Don't bother me with details just tell me when they're done." James Price
You set Parent by adding the control to the Controls collection of the parent. Parent will tell you if your control belongs to a different control's Controls collection.
-
You set Parent by adding the control to the Controls collection of the parent. Parent will tell you if your control belongs to a different control's Controls collection.
But I would still have to know what the control was under neath the control I am dragging. I cannot use whats under my mouse because that would be what i was dragging. Unless I am just missing the point you are making.
"Details details. Things to do Things to get done. Don't bother me with details just tell me when they're done." James Price
-
But I would still have to know what the control was under neath the control I am dragging. I cannot use whats under my mouse because that would be what i was dragging. Unless I am just missing the point you are making.
"Details details. Things to do Things to get done. Don't bother me with details just tell me when they're done." James Price
Of course. So, you are drawing on a surface (which requires a control), and you know what that surface is. If you detect/manage events applied to *that* surface, you are trapping the relevant events. So you have to build your class from Control, or one of its derivatives.
-
Of course. So, you are drawing on a surface (which requires a control), and you know what that surface is. If you detect/manage events applied to *that* surface, you are trapping the relevant events. So you have to build your class from Control, or one of its derivatives.
-
ahh, i see what you are saying. Thanks, I will give that a try.
"Details details. Things to do Things to get done. Don't bother me with details just tell me when they're done." James Price
Good luck!