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. How can I check inside the control where I am - in design mode or run-time mode?

How can I check inside the control where I am - in design mode or run-time mode?

Scheduled Pinned Locked Moved C#
questiondesign
8 Posts 6 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
    Anonymous
    wrote on last edited by
    #1

    Hello, I have a simple questions: How can I check inside the control where I am - in design mode or run-time mode? Thank you in advance. Goran

    G A 2 Replies Last reply
    0
    • A Anonymous

      Hello, I have a simple questions: How can I check inside the control where I am - in design mode or run-time mode? Thank you in advance. Goran

      G Offline
      G Offline
      gnjunge
      wrote on last edited by
      #2

      Well if you want to know what the parent of the control is just use the Parent property of the control. If you want to know where the mouse is, use the MousePosition property of the control.

      T 1 Reply Last reply
      0
      • G gnjunge

        Well if you want to know what the parent of the control is just use the Parent property of the control. If you want to know where the mouse is, use the MousePosition property of the control.

        T Offline
        T Offline
        Tesic Goran
        wrote on last edited by
        #3

        Actually, I would like to check in the constructor of my control where I am - in designer or in runtime. How can i do that?

        D D 2 Replies Last reply
        0
        • T Tesic Goran

          Actually, I would like to check in the constructor of my control where I am - in designer or in runtime. How can i do that?

          D Offline
          D Offline
          Dan Neely
          wrote on last edited by
          #4

          Say what? None of your code is executed during design time.

          T D 2 Replies Last reply
          0
          • D Dan Neely

            Say what? None of your code is executed during design time.

            T Offline
            T Offline
            Tesic Goran
            wrote on last edited by
            #5

            Are you sure?

            1 Reply Last reply
            0
            • D Dan Neely

              Say what? None of your code is executed during design time.

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              Actually, that's not true. When you drop an instance of your control on a form, the code IS executed. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

              1 Reply Last reply
              0
              • T Tesic Goran

                Actually, I would like to check in the constructor of my control where I am - in designer or in runtime. How can i do that?

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #7

                If your talking about your controls position on the form, AFAIK, you can't do that in the constructor. I don't think your control has it's Location property set until after the constructor returns. I could be wrong though... RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

                1 Reply Last reply
                0
                • A Anonymous

                  Hello, I have a simple questions: How can I check inside the control where I am - in design mode or run-time mode? Thank you in advance. Goran

                  A Offline
                  A Offline
                  afinnell
                  wrote on last edited by
                  #8

                  Every conrol has a property called DesignMode you can check if (DesignMode) { } else { } - Drew

                  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