locked
docking at runtime (urgent) RRS feed

  • Question

  • hello

    I have desktop application and a windows form on to it

    i have set following properties  Now i want to dock the form on windows os screen , dock to right bottm ect at run time.

    this

     

    .ControlBox = false;
    this.Text = string.Empty;
    this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;


    It's Me
    Thursday, May 13, 2010 6:14 AM

Answers

  •   public partial class Form1 : Form
      {
        public Form1()
        {
          InitializeComponent();
          this.Load+=new EventHandler(Form1_Load);
        }
    
        void Form1_Load(object sender, EventArgs e)
        {
          Rectangle r = Screen.PrimaryScreen.Bounds;
          Point p = new Point();
          p.X = r.Width - this.Width;
          p.Y = r.Height - this.Height;
          this.Location = p;
        }
      }
    Lemme know if this is what you wanted.
    Paras
    • Marked as answer by Liliane Teng Wednesday, May 19, 2010 3:36 PM
    Thursday, May 13, 2010 9:58 AM
  •   public partial class Form1 : Form
      {
        public Form1()
        {
          InitializeComponent();
          this.Load+=new EventHandler(Form1_Load);
        }
    
        void Form1_Load(object sender, EventArgs e)
        {
          Rectangle r = new Rectangle();
          r = Screen.PrimaryScreen.WorkingArea;
    
          Point p = new Point();
          p.X = r.Width - this.Width;
          p.Y = r.Height - this.Height;
          this.Location = p;
    
        }
      }
    Hope this helps :) . Plz mark as answer if so
    • Proposed as answer by insigniya Friday, May 14, 2010 8:13 PM
    • Marked as answer by Liliane Teng Wednesday, May 19, 2010 3:37 PM
    Friday, May 14, 2010 8:00 PM
  • you can also set form's TopMost property to true.


    Paras
    • Marked as answer by Liliane Teng Wednesday, May 19, 2010 3:37 PM
    Friday, May 14, 2010 8:45 PM

All replies

  • You can set the size to maximize so that your form fills the complete screen area.

    this.ControlBox = false

    this.WindowState = System.Windows.Forms.FormWindowState.Maximized

    Thursday, May 13, 2010 6:24 AM
  • you can't dock it to the screen, dock is within a control.

    however you can set the location and the size of the form to match the effect given by dock, set the location, size, and startposition properties for the form, remove the maximize button from the controls box, and change the border type to fixed.


    Mahmoud Darwish Senior Software Developer C#/VB
    Thursday, May 13, 2010 6:24 AM
  • use-

                this.Dock = DockStyle.Fill;

    but it will dock itself in parent control..

     

    jayant

    Thursday, May 13, 2010 7:55 AM
  •   public partial class Form1 : Form
      {
        public Form1()
        {
          InitializeComponent();
          this.Load+=new EventHandler(Form1_Load);
        }
    
        void Form1_Load(object sender, EventArgs e)
        {
          Rectangle r = Screen.PrimaryScreen.Bounds;
          Point p = new Point();
          p.X = r.Width - this.Width;
          p.Y = r.Height - this.Height;
          this.Location = p;
        }
      }
    Lemme know if this is what you wanted.
    Paras
    • Marked as answer by Liliane Teng Wednesday, May 19, 2010 3:36 PM
    Thursday, May 13, 2010 9:58 AM
  • hello

       many thanks for reply, IT WORK BUT I WANT IT TO BE ABOVE OPERATING SYSTEM TASK BAR, CAN I GET OS TASKBAR HEIGHT SO THAT I CAN DISPAY ABOVE OS TASK BAR , KEEP IN MIND USER CAN INCRESS OS TASKBAR WIDTH.

    IN ANY CASE FORM SHOULD BE ABBOVE OS TASK BAR NOT BEHIND

     

    PLZ HELP 

     


    It's Me
    Thursday, May 13, 2010 4:57 PM
  •   public partial class Form1 : Form
      {
        public Form1()
        {
          InitializeComponent();
          this.Load+=new EventHandler(Form1_Load);
        }
    
        void Form1_Load(object sender, EventArgs e)
        {
          Rectangle r = new Rectangle();
          r = Screen.PrimaryScreen.WorkingArea;
    
          Point p = new Point();
          p.X = r.Width - this.Width;
          p.Y = r.Height - this.Height;
          this.Location = p;
    
        }
      }
    Hope this helps :) . Plz mark as answer if so
    • Proposed as answer by insigniya Friday, May 14, 2010 8:13 PM
    • Marked as answer by Liliane Teng Wednesday, May 19, 2010 3:37 PM
    Friday, May 14, 2010 8:00 PM
  • you can also set form's TopMost property to true.


    Paras
    • Marked as answer by Liliane Teng Wednesday, May 19, 2010 3:37 PM
    Friday, May 14, 2010 8:45 PM