How to set Location of Button, Label and Panel.........

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mahyog
    New Member
    • Sep 2010
    • 9

    How to set Location of Button, Label and Panel.........

    Hello everyone,

    I want to dynamically change location of button, label and panel within the form that can be automatically appear when I restore and maximize the form.

    Please guys help me.

    Thanks a lot..........
  • GaryTexmo
    Recognized Expert Top Contributor
    • Jul 2009
    • 1501

    #2
    All controls have a Location property on them. You should be able to set them in response to an event. Is your form layout intended to drastically appear when you maximize it though, or are you just wanting things to stay relative to each other? If the latter, take a look at the Anchor property.

    I'm not quite sure if I've answered your question, please let me know if that's what you were looking for or provide a bit more detail on what you're trying to do.

    Thanks!

    Comment

    • Mahyog
      New Member
      • Sep 2010
      • 9

      #3
      Thanx GaryTexmo

      but initially my form is normal i.e. restore and my panel is placed on form at VS if I change the size of form its location changes and at when I run the application and if I maximize the form again its location changes I don't want that I want to place panel at bottom and it should appear at bottom when I Restore and Maximize my form.

      I think you will now understand what I want.

      Thanks!

      Comment

      • Christian Binder
        Recognized Expert New Member
        • Jan 2008
        • 218

        #4
        As Gary already said, the Anchor-property will be suitable.
        Try setting it to Bottom or Right | Bottom or Left | Bottom.

        Comment

        • GaryTexmo
          Recognized Expert Top Contributor
          • Jul 2009
          • 1501

          #5
          You can do that via the designer, it's neat the bottom of the properties pane for a control. You can also do it programatically (as Christian Binder pointed out)...

          Code:
          myControl.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
          You use | to combine flags (they are binary values, check the definition of AnchorStyles to see what I mean)

          Comment

          • Mahyog
            New Member
            • Sep 2010
            • 9

            #6
            Thanks guys it solve my problem........ .

            Comment

            Working...