|
Article relates to
|
RadControls for Winforms, Q1 2008
|
|
Created by
|
Martin Vasilev
|
|
Last modified
|
April 18, 2008
|
|
Last modified by
|
Martin Vasilev
|
HOW-TO
Use
RadForm control
DESCRIPTION
The purpose of this article is to familiarize you with the
RadForm control and to demonstrate some of its features.
OVERVIEW
The
RadForm control allows you to design and display a rounded Windows form that resembles the Office 2007 style. The control comes with an integrated
TitleBar to easily add forms with a custom look and feel. The shape of
RadForm is predefined, and unlike the
ShapedForm it cannot be changed. The
RadForm is NOT a descendant of
ShapedForm.
It offers a new way of rapidly creating themed windows forms. The
ShapedForm remains as a control that offers more flexibility when you need to make a custom and specifically shaped window.
USAGE
It is very easy to migrate from the standard .NET 2.0 Form to a
RadForm. You only need to change the inheritance of your form from the standard Microsoft Form to
RadForm, as shown below:
[C#] Inheriting from RadForm:
| namespace RadFormDemo |
| { |
| public partial class Form1 : Telerik.WinControls.RadForm |
| { |
| public Form1() |
| { |
| InitializeComponent(); |
| } |
| } |
| } |
[VB.NET] Inheriting from RadForm:
| Class Form1 |
| Inherits Telerik.WinControls.RadForm |
RadForm Elements
RadForm has its title bar and title bar buttons built-in. You can access the title bar and its buttons using the
FormElement.TitleBar member. To customize the minimize, maximize and close buttons, use the
RadTitleBar.TitleBarElement MinimizeButton,
MaximizeButton and
CloseButton members. Each button is a
RadButtonElement type that includes properties to control text, image, and layout.
[C#] Accessing the title bar:
| this.FormElement.TitleBar.Text = "Open File"; |
| this.FormElement.TitleBar.MaximizeButton.Enabled = false; |
| this.FormElement.TitleBar.MinimizeButton.Enabled = false; |
[VB.NET] Accessing the title bar:
| Me.FormElement.TitleBar.Text = "Open File" |
| Me.FormElement.TitleBar.MaximizeButton.Enabled = False |
| Me.FormElement.TitleBar.MinimizeButton.Enabled = False |
You can access the form border through
FormElement.BorderPrimitive. Then you can customize the border to suit your needs:
[C#] Setting the border color to system default::
| this.FormElement.BorderPrimitive.ForeColor = System.Drawing.Color.Green; |
[VB.NET] Setting the border color to system default:
| Me.FormElement.BorderPrimitive.ForeColor = System.Drawing.Color.Green |
You can set the background color of the
RadForm using the
ClientFill property:
[C#] Setting the background color
| this.FormElement.ClientFill.BackColor = System.Drawing.Color.Beige; |
[VB.NET] Setting the background color:
| Me.FormElement.ClientFill.BackColor = System.Drawing.Color.Beige |
Please Sign In to rate this article.