none
Visual Studio: Snap lines with layered panels

    Question

  • Hello Everybody,

    I'm working in Visual Studio with a Windows Forms Application that has layered panels.  It's a split panel view, with a tree of options for the user to select on the left, and based on their selection, the appropriate panel if brought to the front on the right.

    When designing panels with the Designer in Visual Studio, I take advantage of the snap lines for aligning controls.  I've noticed after adding several layers of panels, that the snap lines consider all the panel layers, not just the panel that I'm designing on the top.  This has become an annoyance, as it's becoming more and more difficult to align controls on the panel.

    Is there a settings somewhere that I've missed, for having the snap lines remain focused on the current panel in which I'm laying out, and to ignore the other panels buried underneath?  I can't be the first person to layer panels on top of each other...

    Thanks!

    Thursday, November 17, 2016 4:42 PM

All replies

  • Hi fonbr01,

    According to your description, you mean when you add several layers of panels in your WinForm page, the snap lines will consider all the panel layers as below screenshot shows, is it right?

    This is the default action when you draw the controls in current panel in WinForm Designer, because it need to consider whether it is in neat with other controls. But when you drag this controls, it will only consider current panel that you are working on.

    So I suggest you could draw the controls first and then through drag to layout it on current panel based on the snap lines.

    If misunderstanding, please provide some screenshots to help understanding your problem. Thanks.

    Best Regards,
    Weiwei


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, November 18, 2016 8:02 AM
    Moderator
  • Hi Weiwei,

    Thanks for your response.  I might try using a separate WinForm, as a sandbox for building new panels, then copying over the finished panel on top of my existing WinForm that already has so many layers.

    My example is a bit more complex.  Using your screenshot, imagine you had 9x panels of the same size layered on top of Panel1.  And each panel you add has its own unique layout of controls.  The snap lines consider not only the current layer, but all the controls from layers in the background, making it impossible to line anything up any more.

    Currently I use the "Document Outline" feature in Visual Studio to move panels from the background, to the top of the stack, so I can make desired changes.

    In my Application, I have a TreeView control on the left, such that depending on the selection made by the user, the appropriate panel with the requested functionality is displayed on the right, while all other panels are hidden.  This allows me to make a multipurpose application that performs various functions, without having to build and maintain a separate WinForm (or application) for each piece of functionality.

    Thanks,

    Brian

    Wednesday, December 7, 2016 3:39 AM