New to Telerik UI for WinForms? Start a free 30-day trial

A standard behavior for RadForm.

Definition

Namespace:Telerik.WinControls.UI

Assembly:Telerik.WinControls.UI.dll

Syntax:

C#
public class RadFormBehavior : ThemedFormBehavior, IComponent, IDisposable

Inheritance: objectMarshalByRefObjectComponentFormControlBehaviorThemedFormBehaviorRadFormBehavior...

Implements: IComponentIDisposable

Inherited Members ThemedFormBehavior.GetMappedWindowPoint(Point)ThemedFormBehavior.GetMaximumFormHeightAccordingToCurrentScreen()ThemedFormBehavior.RefreshNC()ThemedFormBehavior.InvalidateNC(Rectangle)ThemedFormBehavior.OnGetMinMaxInfo(MinMaxInfo)ThemedFormBehavior.OnNCPaint(Graphics)ThemedFormBehavior.PaintElement(IGraphics, Rectangle, VisualElement)ThemedFormBehavior.IsMaximizedThemedFormBehavior.IsMinimizedThemedFormBehavior.IsNormalThemedFormBehavior.CurrentFormStateThemedFormBehavior.IsMdiChildMaximizedThemedFormBehavior.FormMdiClientThemedFormBehavior.IsMenuInFormThemedFormBehavior.MainMenuInFormThemedFormBehavior.MaximizedMDIChildThemedFormBehavior.TopResizeFrameThemedFormBehavior.TopLeftResizeFrameThemedFormBehavior.LeftResizeFrameThemedFormBehavior.BottomLeftResizeFrameThemedFormBehavior.BottomResizeFrameThemedFormBehavior.BottomRightResizeFrameThemedFormBehavior.RightResizeFrameThemedFormBehavior.TopRightResizeFrameThemedFormBehavior.CaptionFrameThemedFormBehavior.LeftBorderFrameThemedFormBehavior.BottomBorderFrameThemedFormBehavior.RightBorderFrameThemedFormBehavior.ClientFrameThemedFormBehavior.CurrentFormParamsThemedFormBehavior.FormFormControlBehavior.targetHandlerFormControlBehavior.FormHandleCreated()FormControlBehavior.CallBaseWndProc(ref Message)FormControlBehavior.CallDefWndProc(ref Message)FormControlBehavior.OnAssociatedFormPaint(PaintEventArgs)FormControlBehavior.OnAssociatedFormPaintBackground(PaintEventArgs)...

Constructors

Creates an instance of the RadFormBehavior class. This instance has no Form associated with it.

C#
public RadFormBehavior()

Creates an instance of the RadFormBehavior class.

C#
public RadFormBehavior(IComponentTreeHandler treeHandler, bool shouldCreateChildren)
Parameters:treeHandlerIComponentTreeHandler

An IComponentTreeHandler instance.

shouldCreateChildrenbool

A flag that determines whether the CreateChildItems call is rerouted to the behavior.

Creates an instance of the RadFormBehavior class.

C#
public RadFormBehavior(IComponentTreeHandler treeHandler)
Parameters:treeHandlerIComponentTreeHandler

An IComponentTreeHandler instance.

Properties

Gets or sets a boolean value indicating whether the behavior paints in the NC area of the Form when OS is Vista or later and Composition is enabled.

C#
public override bool AllowTheming { get; set; }

Overrides: ThemedFormBehavior.AllowTheming

Gets the Border width of the Form.

C#
public override Padding BorderWidth { get; }

Overrides: FormControlBehavior.BorderWidth

Gets the Caption Height of the Form.

C#
public override int CaptionHeight { get; }

Overrides: FormControlBehavior.CaptionHeight

Gets the bounds of the title-bar text element used to render the form caption.

C#
public override Rectangle CaptionTextBounds { get; }

Overrides: ThemedFormBehavior.CaptionTextBounds

Gets the margin that determines the position and size of the client area of the Form.

C#
public override Padding ClientMargin { get; }

Overrides: FormControlBehavior.ClientMargin

Gets the element tree that renders the form frame and title bar.

C#
public override RadElement FormElement { get; }

Overrides: FormControlBehavior.FormElement

Gets the bounding rectangle of the horizontal scrollbar. Returns an empty rectangle if the scrollbar is not visible.

C#
protected virtual Rectangle HorizontalScrollbarBounds { get; }

Gets the bounds of the title-bar icon element.

C#
public override Rectangle IconBounds { get; }

Overrides: ThemedFormBehavior.IconBounds

Gets the bounds of the MDI control strip, which hosts the MDI child window buttons.

C#
public override Rectangle MenuBounds { get; }

Overrides: ThemedFormBehavior.MenuBounds

Gets the bounding rectangle of the sizing grip that appears when both scrollbars are visible.

C#
protected virtual Rectangle ScrollbarSizingGripBounds { get; }

Gets the bounds of the title-bar system buttons.

C#
public override Rectangle SystemButtonsBounds { get; }

Overrides: ThemedFormBehavior.SystemButtonsBounds

Gets the bounding rectangle of the vertical scrollbar. Returns an empty rectangle if the scrollbar is not visible.

C#
protected virtual Rectangle VerticalScrollbarBounds { get; }

Methods

This method adjusts the FormElement according to the styles currently applied to the Form. For example, the MinimizeButton, MaximizeButton and CloseButton in the Title Bar are enabled/disabled according to whether the corresponding window style is applied.

C#
protected void AdjustFormElementForCurrentStyles()

Changes the visibility of the separate items within the RadFormElement's element tree according to the current Form state.

C#
protected void AdjustFormElementForFormState(int? formState)
Parameters:formStateint?

The state of the Form as it comes from the WM_SIZE message

Calculates the client margin based on the current form and form element settings

C#
public virtual Padding CalculateDynamicClientMargin()
Returns:

Padding

Creates the form element, synchronizes its caption, and connects its title-bar buttons and scrollbars to the form.

C#
public override void CreateChildItems(RadElement parent)
Parameters:parentRadElement

The element that receives the form element.

Overrides: FormControlBehavior.CreateChildItems(RadElement)

Creates the element tree used to render a RadForm.

C#
protected virtual RadFormElement CreateFormElement()
Returns:

RadFormElement

A new RadFormElement.

Adjusts native window styles to match the form's box, taskbar, and border settings, and removes native scrollbar styles because scrolling is rendered by the form element.

C#
public override CreateParams CreateParams(CreateParams parameters)
Parameters:parametersCreateParams

The native window parameters to adjust.

Returns:

CreateParams

The adjusted window parameters.

Overrides: ThemedFormBehavior.CreateParams(CreateParams)

Detaches the event handlers registered on the form when this behavior is disposed.

C#
protected override void Dispose(bool disposing)
Parameters:disposingbool

true to release managed resources.

Overrides: ThemedFormBehavior.Dispose(bool)

Gets the Caption Height according to the Styles applied and the current state of the form.

C#
protected virtual int GetDynamicCaptionHeight()
Returns:

int

A value representing the height of the caption.

Gets a Padding object which represents the window NC margin according to the currently set styles.

C#
protected virtual Padding GetWindowRealNCMargin()
Returns:

Padding

The form NC margin.

Routes non-client hit testing, mouse, activation, style, icon, text, and menu messages to the form element. When theming is enabled, unhandled messages are passed to the base handler. When it is disabled, the method returns false for ordinary messages but still handles non-MDI hit testing.

C#
public override bool HandleWndProc(ref Message m)
Parameters:mMessage

The window message to process.

Returns:

bool

Whether this behavior or the base handler consumed the message.

Overrides: ThemedFormBehavior.HandleWndProc(ref Message)

Invalidates the corresponding non-client area instead of the client-area element bounds.

C#
public override void InvalidateElement(RadElement element, Rectangle bounds)
Parameters:elementRadElement

The element that changed.

boundsRectangle

The element bounds to invalidate.

Overrides: ThemedFormBehavior.InvalidateElement(RadElement, Rectangle)

This method translates a point which is in client coordinates to a point in NC coordinates. Used when the Form has captured the mouse and NC mouse events have to be processed.

C#
protected virtual Point NCFromClientCoordinates(Point clientCoordinates)
Parameters:clientCoordinatesPoint

A point in client coordinates.

Returns:

Point

The point in NC coordinates.

Updates the custom title-bar text after the active MDI child text changes.

C#
protected override void OnActiveMDIChildTextChanged()

Overrides: ThemedFormBehavior.OnActiveMDIChildTextChanged()

Fires when a Form has been associated with the behavior.

C#
protected override void OnFormAssociated()

Overrides: ThemedFormBehavior.OnFormAssociated()

Updates the form element when the native window state changes.

C#
protected override void OnWindowStateChanged(int currentFormState, int newFormState)
Parameters:currentFormStateint

The previous native window-state value.

newFormStateint

The new native window-state value.

Overrides: ThemedFormBehavior.OnWindowStateChanged(int, int)

Calculates the bounding rectangle of the horizontal scrollbar.

C#
protected virtual Rectangle SynchronizeHorizontalScrollbarState()
Returns:

Rectangle

An instance of the Rectangle struct that represents the position and the size of the horizontal scrollbar.

This method synchronizes the values of the standard horizontal scrollbar with the RadScrollBarElement in the Form's element hierarchy.

C#
protected virtual void SynchronizeHorizontalScrollbarValues()

Recalculates the form layout and copies the native scrollbar ranges and values into the element scrollbars.

C#
protected void SynchronizeScrollbarsValues()

Calculates the bounding rectangle of the vertical scrollbar.

C#
protected virtual Rectangle SynchronizeVerticalScrollbarState()
Returns:

Rectangle

An instance of the Rectangle struct that represents the position and the size of the vertical scrollbar

This method synchronizes the values of the standard vertical scrollbar with the RadScrollBarElement in the Form's element hierarchy.

C#
protected virtual void SynchronizeVerticalScrollbarValues()