0

I have one Panel, I have set the DockStyle as Top but I want to set start location like ( 0, 10), means I want to start this panel from 10 position down from the top. I have tried Padding and Margin but not working, changing the DockStyle also not working.

this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
        this.panel1.Location = new System.Drawing.Point(0, 10);
vivek jain
  • 79
  • 4

1 Answers1

1

You should add padding to the control that contains panel1, not to the panel itself:

// using "this" assuming you're in a form that directly contains panel1
this.Padding = new System.Windows.Forms.Padding(0, 10, 0, 0);
panel1.Dock = System.Windows.Forms.DockStyle.Top;
C.Evenhuis
  • 25,996
  • 2
  • 58
  • 72