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

Provides window-message and layout integration for forms whose non-client UI is rendered by a child control. Derived behaviors supply the form element and handle form-state and composition changes.

Definition

Namespace:Telerik.WinControls.UI

Assembly:Telerik.WinControls.UI.dll

Type Parameters:

T

The RadNonClientUIControl that renders the non-client UI.

Syntax:

C#
public abstract class RadNonClientUIBaseFormBehavior<T> : ThemedFormBehavior, IComponent, IDisposable where T : RadNonClientUIControl

Inheritance: objectMarshalByRefObjectComponentFormControlBehaviorThemedFormBehaviorRadNonClientUIBaseFormBehavior<T>...

Derived Classes: RadRibbonFormBehaviorRadTabbedFormBehaviorRadToolbarFormBehavior

Implements: IComponentIDisposable

Inherited Members ThemedFormBehavior.GetMappedWindowPoint(Point)ThemedFormBehavior.GetMaximumFormHeightAccordingToCurrentScreen()ThemedFormBehavior.OnWindowStateChanged(int, int)ThemedFormBehavior.RefreshNC()ThemedFormBehavior.InvalidateNC(Rectangle)ThemedFormBehavior.OnNCPaint(Graphics)ThemedFormBehavior.PaintElement(IGraphics, Rectangle, VisualElement)ThemedFormBehavior.InvalidateElement(RadElement, Rectangle)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.CallBaseWndProc(ref Message)FormControlBehavior.CallDefWndProc(ref Message)FormControlBehavior.OnAssociatedFormPaint(PaintEventArgs)FormControlBehavior.BorderWidth...

Constructors

Creates an instance of the "RadNonClientUIBaseFormBehavior" class.

C#
public RadNonClientUIBaseFormBehavior()

Creates an instance of the "RadNonClientUIBaseFormBehavior" class.

C#
public RadNonClientUIBaseFormBehavior(IComponentTreeHandler treeHandler, bool shouldHandleCreateChildItems)
Parameters:treeHandlerIComponentTreeHandler

The associated IComponentTreeHandler implementation.

shouldHandleCreateChildItemsbool

Determines whether the behavior handles the CreateChildItems call.

Creates an instance of the "RadNonClientUIBaseFormBehavior" class.

C#
public RadNonClientUIBaseFormBehavior(IComponentTreeHandler treeHandler)
Parameters:treeHandlerIComponentTreeHandler

The IComponentTreeHandler implementation associated with this behavior.

Fields

The non-client element whose mouse capture is released when the pointer leaves the form.

C#
protected RadElement capturedNCItem

Caps the frame-border inset used when calculating the region of a maximized form with composition enabled.

C#
protected const int MaxFormBorderHeight = 4

Minimum bottom inset used to keep the auto-hide taskbar reveal area available.

C#
protected const int RegionHeightEllipse = 9

Properties

Gets or sets value indicating whether the NC control is drawn over the Aero glass under Vista or later versions of Windows.

C#
[Browsable(false)]
public override bool AllowTheming { get; set; }

Overrides: ThemedFormBehavior.AllowTheming

Returns a zero for the caption height.

C#
public override int CaptionHeight { get; }

Overrides: FormControlBehavior.CaptionHeight

Gets the caption text element's bounds in the hosted control, or an empty rectangle if the control is absent.

C#
public override Rectangle CaptionTextBounds { get; }

Overrides: ThemedFormBehavior.CaptionTextBounds

Gets the margin reserved for the client area, accounting for the form border and composition state. When maximized, the bottom margin uses RegionHeightEllipse to preserve the taskbar reveal area.

C#
public override Padding ClientMargin { get; }

Overrides: FormControlBehavior.ClientMargin

Gets a boolean value indicating whether composition effects are enabled for the form.

C#
public bool CompositionEffectsEnabled { get; }

Gets a value indicating whether composition effects are enabled for the Operating System.

C#
protected bool CompositionEnabled { get; }

Gets the element that renders this behavior's form chrome.

C#
public override RadElement FormElement { get; }

Overrides: FormControlBehavior.FormElement

This behavior renders icon content through the hosted non-client control rather than a separate native region.

C#
public override Rectangle IconBounds { get; }

Overrides: ThemedFormBehavior.IconBounds

This behavior renders menu content through the hosted non-client control rather than a separate native region.

C#
public override Rectangle MenuBounds { get; }

Overrides: ThemedFormBehavior.MenuBounds

Gets the hosted non-client control, locating and caching it among the associated form's child controls when needed.

C#
protected virtual T NonClientUIControl { get; set; }
Property Value:

The control attached to the form, or null when no matching control is present.

Gets the system-buttons element's bounds in the hosted control, or an empty rectangle if the control is absent.

C#
public override Rectangle SystemButtonsBounds { get; }

Overrides: ThemedFormBehavior.SystemButtonsBounds

Gets an integer representing the top client margin of the form when composition is enabled.

C#
public abstract int TopCompositionMargin { get; }

Methods

Applies behavior-specific changes required by the current desktop-composition state.

C#
protected abstract void AdjustBehaviorForCompositionSate()

Updates the form element to reflect a native window-state value.

C#
protected abstract void AdjustFormElementForFormState(int? currentFormState)
Parameters:currentFormStateint?

The native window-state value, or null when unavailable.

Updates the hosted icon element from the form's icon and visibility settings. Application-menu forms and tool-window styles hide the icon.

C#
public virtual void AdjustFormIconVisibility()

Updates custom system-button visibility and enabled states to match the form's border and box settings.

C#
protected void AdjustSystemButtonsForStyle()

Determines whether a child-control notification is processed while the form is in the designer.

C#
protected virtual bool CanHandleParentNotify(ref Message m)
Parameters:mMessage

The parent-notification message.

Returns:

bool

true in the base implementation.

Determines whether this behavior processes window messages for the associated form.

C#
protected virtual bool CanHandleWndProc()
Returns:

bool

true in the base implementation.

Creates the form element and adds it to the supplied parent element.

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

The element that receives the form element.

Overrides: FormControlBehavior.CreateChildItems(RadElement)

Creates the element that renders the form's custom non-client UI.

C#
protected abstract RadElement CreateFormElement()
Returns:

RadElement

Removes the native caption style when operating without desktop composition.

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 form event handlers and releases derived non-client resources before base disposal.

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

true to release managed resources.

Overrides: ThemedFormBehavior.Dispose(bool)

Provides a cleanup hook for derived behaviors to release resources associated with the non-client control.

C#
protected virtual void DisposeNonClientUIControlImpls()

Extends the desktop-composition frame into the client area by TopCompositionMargin. Does nothing until the form has a handle.

C#
protected virtual void ExtendFrameIntoClientArea()

Provides a hook for derived behaviors to respond to a child control being added to the form.

C#
protected virtual void Form_ControlAdded(object sender, ControlEventArgs e)
Parameters:senderobject

The form raising the event.

eControlEventArgs

Information about the added control.

Initializes the non-client control and updates form-state and composition settings after the form loads.

C#
protected virtual void Form_Load(object sender, EventArgs e)
Parameters:senderobject

The form raising the load event.

eEventArgs

The event data.

Provides a hook for derived behaviors to respond to form resizing.

C#
protected virtual void Form_SizeChanged(object sender, EventArgs e)
Parameters:senderobject

The form raising the event.

eEventArgs

The event data.

Loads the hosted non-client control's element tree after the form handle is created.

C#
public override void FormHandleCreated()

Overrides: FormControlBehavior.FormHandleCreated()

Dispatches selected non-client, activation, style, icon, text, and mouse messages when CanHandleWndProc() permits it. Depending on composition state, unhandled messages are delegated to the base behavior or left unhandled.

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

The window message to process.

Returns:

bool

true when the message is handled; otherwise, false or the base handler's result.

Overrides: ThemedFormBehavior.HandleWndProc(ref Message)

Provides a hook to initialize menu-strip state required by a derived non-client behavior.

C#
protected virtual void InitializeDummyMenuStrip()

Initializes the hosted control that renders the form's non-client UI.

C#
protected abstract void InitializeNonClientUIControl()

Indicates whether the non-client control uses an application menu in place of the form icon.

C#
protected virtual bool IsApplicationMenu()
Returns:

bool

false in the base implementation.

Converts a client-coordinate point to the non-client coordinate space by applying ClientMargin.

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

A point in the form's client area.

Returns:

Point

The corresponding point in the non-client coordinate space.

Synchronizes the hosted non-client control's text with the form after the active MDI child text changes.

C#
protected override void OnActiveMDIChildTextChanged()

Overrides: ThemedFormBehavior.OnActiveMDIChildTextChanged()

Calls the base background handler when needed, then excludes the top composition margin from the paint clip.

C#
public override bool OnAssociatedFormPaintBackground(PaintEventArgs args)
Parameters:argsPaintEventArgs

The paint arguments for the associated form.

Returns:

bool

false because this behavior does not report the background as handled.

Overrides: FormControlBehavior.OnAssociatedFormPaintBackground(PaintEventArgs)

Subscribes to form lifecycle events and initializes composition and non-client state immediately or on load.

C#
protected override void OnFormAssociated()

Overrides: ThemedFormBehavior.OnFormAssociated()

Sets the minimum tracking width to the system minimized-window width and the minimum height to 100, then lets the base behavior process the request.

C#
protected override void OnGetMinMaxInfo(MinMaxInfo minMaxInfo)
Parameters:minMaxInfoMinMaxInfo

The native minimum and maximum tracking information to update.

Overrides: ThemedFormBehavior.OnGetMinMaxInfo(MinMaxInfo)

Updates derived non-client state after the base behavior processes a window activation message.

C#
protected abstract void OnWMActivateCore(ref Message m)
Parameters:mMessage

The activation message.

Gives derived behaviors an opportunity to process an MDI activation message.

C#
protected virtual bool OnWmMDIActivate(ref Message m)
Parameters:mMessage

The MDI activation message.

Returns:

bool

Whether the derived behavior handled the message.

Handles a non-client left-button press dispatched from HandleWndProc(ref Message).

C#
protected abstract void OnWmNCLeftMouseButtonDown(ref Message m)
Parameters:mMessage

The non-client mouse message.

Handles a non-client left-button release dispatched from HandleWndProc(ref Message).

C#
protected abstract void OnWmNCLeftMouseButtonUp(ref Message m)
Parameters:mMessage

The non-client mouse message.

Routes a non-client right-button release to the form and opens the system menu when the title bar was hit.

C#
protected virtual void OnWMNCRightButtonUp(ref Message m)
Parameters:mMessage

The non-client mouse message.

Provides a design-time hook for handling parent notifications; the base implementation does nothing.

C#
protected virtual void OnWmParentNotifyInDesigner(ref Message m)
Parameters:mMessage

The parent-notification message.

Forwards the icon message to the native form and synchronizes its small icon with the hosted title-bar element.

C#
protected virtual void OnWmSetIcon(ref Message m)
Parameters:mMessage

The window message containing the icon handle and icon size.

Forwards the text-setting message to the base window procedure.

C#
protected virtual void OnWmSetText(ref Message m)
Parameters:mMessage

The window message containing the new form text.

Applies an inset region to an unconstrained maximized form, or uses the root element's shape (falling back to a rounded region) for other window states.

C#
protected void ResetFormRegion()

Shows or hides the themed form frame according to the requested composition state.

C#
protected abstract void UpdateFormForThemingState(bool showAero)
Parameters:showAerobool

true to enable the themed composition frame; otherwise, hide it.

Provides a hook for derived behaviors to refresh MDI buttons and caption text before non-client recalculation.

C#
protected virtual void UpdateMDIButtonsAndCaptionText()

Updates the form and non-client control after the operating system's composition state changes.

C#
protected abstract void UpdateNCComposition()
In this article
DefinitionConstructorsRadNonClientUIBaseFormBehavior()RadNonClientUIBaseFormBehavior(IComponentTreeHandler, bool)RadNonClientUIBaseFormBehavior(IComponentTreeHandler)FieldscapturedNCItemMaxFormBorderHeightRegionHeightEllipsePropertiesAllowThemingCaptionHeightCaptionTextBoundsClientMarginCompositionEffectsEnabledCompositionEnabledFormElementIconBoundsMenuBoundsNonClientUIControlSystemButtonsBoundsTopCompositionMarginMethodsAdjustBehaviorForCompositionSate()AdjustFormElementForFormState(int?)AdjustFormIconVisibility()AdjustSystemButtonsForStyle()CanHandleParentNotify(ref Message)CanHandleWndProc()CreateChildItems(RadElement)CreateFormElement()CreateParams(CreateParams)Dispose(bool)DisposeNonClientUIControlImpls()ExtendFrameIntoClientArea()Form_ControlAdded(object, ControlEventArgs)Form_Load(object, EventArgs)Form_SizeChanged(object, EventArgs)FormHandleCreated()HandleWndProc(ref Message)InitializeDummyMenuStrip()InitializeNonClientUIControl()IsApplicationMenu()NCFromClientCoordinates(Point)OnActiveMDIChildTextChanged()OnAssociatedFormPaintBackground(PaintEventArgs)OnFormAssociated()OnGetMinMaxInfo(MinMaxInfo)OnWMActivateCore(ref Message)OnWmMDIActivate(ref Message)OnWmNCLeftMouseButtonDown(ref Message)OnWmNCLeftMouseButtonUp(ref Message)OnWMNCRightButtonUp(ref Message)OnWmParentNotifyInDesigner(ref Message)OnWmSetIcon(ref Message)OnWmSetText(ref Message)ResetFormRegion()UpdateFormForThemingState(bool)UpdateMDIButtonsAndCaptionText()UpdateNCComposition()
Not finding the help you need?
Contact Support