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. Initial Positioning

Initial Positioning

Scheduled Pinned Locked Moved C#
csharpquestionlearning
4 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.
  • W Offline
    W Offline
    Wackatronic
    wrote on last edited by
    #1

    I am writing my first 'real' C# control. It's a taskbar that can be positioned to Top/Bottom/Left/Right. What I need to know is which event do I need to use to position it to the bottom when it's initially created. I tried putting the code in the constructor but you cannot get the parent's properties until after creation. Can someone please point me in the right direction? Former VB programmer learning C#. X| Thank you

    No comment, Mr. Senator

    H M 2 Replies Last reply
    0
    • W Wackatronic

      I am writing my first 'real' C# control. It's a taskbar that can be positioned to Top/Bottom/Left/Right. What I need to know is which event do I need to use to position it to the bottom when it's initially created. I tried putting the code in the constructor but you cannot get the parent's properties until after creation. Can someone please point me in the right direction? Former VB programmer learning C#. X| Thank you

      No comment, Mr. Senator

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      You mean docked to a container, like a Form? See the Dock property, which can be set in the constructor. Also, you can support initialization after instantiation by implementing the ISupportInitialize interface. The VS.NET designer will automatically call the BeginInit method after instantiating your control, and will call EndInit when done in the InitializeComponent call (you can do this yourself, too - I'm just telling you how VS.NET handles controls that implement this interface). This way, in your implementation of the EndInit interface, you should have a valid Parent reference (so long as your control was added to the parent's Controls collection property) and can do what you need to. Implementing this interface is a great way to suport initialization of your control in steps. PS: You could do this using your own implementation without implementing the interface, but VS.NET won't care. Implementing the ISupportInitialize interface is a good way to add designer support for your control. There are other designer-oriented things you can do, which are handy for a lot of programmers. Read Enhancing Design-Time Support[^] in the .NET Framework SDK for more information.

      Microsoft MVP, Visual C# My Articles

      W 1 Reply Last reply
      0
      • W Wackatronic

        I am writing my first 'real' C# control. It's a taskbar that can be positioned to Top/Bottom/Left/Right. What I need to know is which event do I need to use to position it to the bottom when it's initially created. I tried putting the code in the constructor but you cannot get the parent's properties until after creation. Can someone please point me in the right direction? Former VB programmer learning C#. X| Thank you

        No comment, Mr. Senator

        M Offline
        M Offline
        Meysam Mahfouzi
        wrote on last edited by
        #3

        Take a look at this:C# does Shell, Part 3[^] That is really helpful. abcdabcdabcdabcda Don't forget, that's

        Persian Gulf

        not Arabian gulf!


        Why do we close our eyes, when we dream?, When we cry?, When we imagine?, When we kiss?, Its because the most beautiful things in the world are unseen


        Murphy:
        Click Here![^]


        I'm thirsty like sun, more landless than wind...

        1 Reply Last reply
        0
        • H Heath Stewart

          You mean docked to a container, like a Form? See the Dock property, which can be set in the constructor. Also, you can support initialization after instantiation by implementing the ISupportInitialize interface. The VS.NET designer will automatically call the BeginInit method after instantiating your control, and will call EndInit when done in the InitializeComponent call (you can do this yourself, too - I'm just telling you how VS.NET handles controls that implement this interface). This way, in your implementation of the EndInit interface, you should have a valid Parent reference (so long as your control was added to the parent's Controls collection property) and can do what you need to. Implementing this interface is a great way to suport initialization of your control in steps. PS: You could do this using your own implementation without implementing the interface, but VS.NET won't care. Implementing the ISupportInitialize interface is a good way to add designer support for your control. There are other designer-oriented things you can do, which are handy for a lot of programmers. Read Enhancing Design-Time Support[^] in the .NET Framework SDK for more information.

          Microsoft MVP, Visual C# My Articles

          W Offline
          W Offline
          Wackatronic
          wrote on last edited by
          #4

          Thank you Heath this was extremely helpful.

          No comment, Mr. Senator

          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