Nevron .NET Vision
User Interface for .NET / User's Guide / Custom Forms / Using the NForm Component

In This Topic
    Using the NForm Component
    In This Topic
     Overview
    The NForm component derives from the standard System.Windows.Forms Form and completely overrides its non-client (NC) painting and sizing in order to provide custom, template-based, appearance and metrics. This however leads to some differences in behavior compared to the standard Form.
     Anchoring Direct Form’s Children

    The direct children of an NForm will not support anchoring. We have tried numerous approaches to overcome this limitation but it is in the core Windows Forms Layout system. Our NForm overrides the WM_NCCALCSIZE notification in order to provide the custom non-client metrics while the base Form has its FormBorderStyle set to None. Thus, the initial layout of all anchored controls will be offset by the caption height along the Y axis and by the left border width by the X axis. This will appear every time when the form is loaded either at design or at run-time.

    The docking layout system however will work as the sizes of the controls are calculated on the fly. So, there is a simple way to prevent the non-desired anchoring behavior – simply drop a Panel with DockStyle.Fill on the form and build your layout on it (or rely entirely on Dock values).

     MainMenu and MDIMenu
    Our NForm will not work with the standard .NET MainMenu component as it resides in the non-client area of the form. It will however work with the NMenuBar, standard MenuStrip or any other third-party vendor menu control. The NForm also will skip notifications, such as WM_MDISETMENU and WM_MDIREFRESHMENU, from the standard MdiClient (used for MDI interfaces) control. If you are however using our document manager (part of the Docking Panels Library) it will automatically add "Minimize", "Restore" and "Close" buttons on an existing NMenuBar control when there is a maximized MDI child.
     Border Styles
    Based on templates rather than window styles, our NForm is customized in a slightly different manner than the standard one. For example if you want a fixed (non-sizable) frame you will have to adjust the Sizable property accordingly. If you want to have a tool window frame with smaller caption and buttons you should create another frame appearance, adjust its metrics, and apply it to your tool windows. For more information see Creating Custom Frame
    See Also