locked
Dock/snap form in windows? RRS feed

  • Question

  • Is it possible to dock/snap a form to the side of the screen -meaning it keeps it's width but fills the total height of the screen? This making it possible for example a browser and the app "maximized" at the same time. Just made a RSS reader that I'd like to do fill the left side of the screen width.
    Wednesday, November 11, 2009 11:30 PM

Answers

  • Yes, for instance you can put, in the Load event of your form:

    Rectangle area = Screen.PrimaryScreen.WorkingArea;
    Location = area.Location;
    Height = area.Height;

    Make sure your form cannot be resized or dragged and you are done.

    HTH
    --mc
    • Proposed as answer by Harry Zhu Wednesday, November 18, 2009 4:18 AM
    • Marked as answer by Harry Zhu Thursday, November 19, 2009 8:56 AM
    Thursday, November 12, 2009 2:36 AM

All replies

  • Yes, for instance you can put, in the Load event of your form:

    Rectangle area = Screen.PrimaryScreen.WorkingArea;
    Location = area.Location;
    Height = area.Height;

    Make sure your form cannot be resized or dragged and you are done.

    HTH
    --mc
    • Proposed as answer by Harry Zhu Wednesday, November 18, 2009 4:18 AM
    • Marked as answer by Harry Zhu Thursday, November 19, 2009 8:56 AM
    Thursday, November 12, 2009 2:36 AM
  • I created such a compoennt for .net, that is ready-to-use.  It snaps to windows, screen edges, and even to windows created in another processes.

    You can check it out at http://www.formsnapper.net/

    Sunday, May 15, 2011 9:47 PM