Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Getting an object location

Getting an object location

Scheduled Pinned Locked Moved C#
visual-studiodocker
8 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AtomRiot
    wrote on last edited by
    #1

    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

    J 1 Reply Last reply
    0
    • A AtomRiot

      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

      J Offline
      J Offline
      Judah Gabriel Himango
      wrote on last edited by
      #2

      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

      A 1 Reply Last reply
      0
      • J Judah Gabriel 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

        A Offline
        A Offline
        AtomRiot
        wrote on last edited by
        #3

        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

        M 1 Reply Last reply
        0
        • A AtomRiot

          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

          M Offline
          M Offline
          mike montagne
          wrote on last edited by
          #4

          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.

          A 1 Reply Last reply
          0
          • M mike montagne

            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.

            A Offline
            A Offline
            AtomRiot
            wrote on last edited by
            #5

            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

            M 1 Reply Last reply
            0
            • A AtomRiot

              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

              M Offline
              M Offline
              mike montagne
              wrote on last edited by
              #6

              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.

              A 1 Reply Last reply
              0
              • M mike montagne

                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.

                A Offline
                A Offline
                AtomRiot
                wrote on last edited by
                #7

                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

                M 1 Reply Last reply
                0
                • A AtomRiot

                  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

                  M Offline
                  M Offline
                  mike montagne
                  wrote on last edited by
                  #8

                  Good luck!

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups