There are many cases when an application needs either have larger borders or higher caption. This is completely achievable with our forms as they override each non-client aspect.
The following code demonstrates how to specify custom settings for a template and assign it to a NForm:
C# |
Copy Code
|
---|---|
//create a new NFrameAppearance object //by default if no segmented images are specified the Simple rendering is applied. NFrameAppearance appearance = new NFrameAppearance(); //customize metrics appearance.LeftBorder = 8; appearance.RightBorder = 8; appearance.BottomBorder = 8; appearance.CaptionHeight = 32; //offset the caption buttons appearance.ButtonsOffset = new Size(4, 8); //create new NForm object and assign it this template NForm form = new NForm(); form.FrameAppearance = appearance; form.ShowDialog(); |
Visual Basic |
Copy Code
|
---|---|
'create a new NFrameAppearance object 'by default if no segmented images are specified the Simple rendering is applied. Dim appearance As NFrameAppearance = New NFrameAppearance() 'customize metrics appearance.LeftBorder = 8 appearance.RightBorder = 8 appearance.BottomBorder = 8 appearance.CaptionHeight = 32 'offset the caption buttons appearance.ButtonsOffset = New Size(4, 8) 'create new NForm object and assign it this template Dim form As NForm = New NForm() form.FrameAppearance = appearance form.ShowDialog() |
The result of the above code:
The template allows for a complete customization of the caption including both image and text. Settings like TextAlign, ImageAlign, ImageTextRelation, etc. are provided so that you can define the caption appearance that suits your forms most.
The following example demonstrates how to manipulate the image and text of a NForm's caption via the NFrameAppearance template:
C# |
Copy Code
|
---|---|
NFrameAppearance appearance = new NFrameAppearance(); //customize settings related with image and text positioning appearance.ImageTextRelation = ImageTextRelation.TextBeforeImage; appearance.ImageAlign = ContentAlignment.MiddleRight; appearance.TextAlign = ContentAlignment.MiddleRight; NForm form = new NForm(); form.FrameAppearance = appearance; form.ShowDialog(); |
Visual Basic |
Copy Code
|
---|---|
Dim appearance As NFrameAppearance = New NFrameAppearance() 'customize settings related with image and text positioning appearance.ImageTextRelation = ImageTextRelation.TextBeforeImage appearance.ImageAlign = ContentAlignment.MiddleRight appearance.TextAlign = ContentAlignment.MiddleRight Dim form AsNForm = New NForm() form.FrameAppearance = appearance form.ShowDialog() |
The result of the above code: