ShapedForm
Represents a form with customizable shape and appearance that can be themed.
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.UI.dll
Syntax:
public class ShapedForm : Form, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable, IContainerControl, IThemeChangeListener
Inheritance: objectMarshalByRefObjectComponentControlScrollableControlContainerControlFormShapedForm...
Derived Classes:
Implements:
Inherited Members
Constructors
Initializes a new instance of the ShapedForm class.
public ShapedForm()
Properties
Allow form's resize
[Browsable(true)]
public bool AllowResize { get; set; }
Gets or sets the BackColor of the ShapedForm.
public override Color BackColor { get; set; }
Overrides:
Gets or sets the pen alignment for the border.
public PenAlignment BorderAlignment { get; set; }
Gets or sets the form's border color
[Browsable(true)]
public Color BorderColor { get; set; }
Gets or sets the outline used to paint the form's border.
protected GraphicsPath BorderPath { get; set; }
Gets or sets the form's border width
[Browsable(true)]
public virtual int BorderWidth { get; set; }
Gets or sets the theme class name for the control.
public string ControlThemeClassName { get; }
Implements:
Adds the minimize-box window style so the form can be minimized or maximized from the taskbar.
protected override CreateParams CreateParams { get; }
Overrides:
Enables or disables transparent background on Vista
[Browsable(true)]
public bool EnableCompositionOnVista { get; set; }
Gets or sets the form's font
[Browsable(true)]
public override Font Font { get; set; }
Overrides:
Gets or sets the form's foreground color
[Browsable(true)]
public override Color ForeColor { get; set; }
Overrides:
Gets or sets the FormBorderStyle of the Form.
public FormBorderStyle FormBorderStyle { get; set; }
Gets or sets the path used as the form's non-rectangular window region.
protected GraphicsPath OuterPath { get; set; }
Gets or sets an instance of the Shape object of a form. The shape of the form is responsible for providing its' border(s) with custom shape.
[Browsable(true)]
public virtual ElementShape Shape { get; set; }
Some predefined shapes are available, like RoundRectShape or EllipseShape. CustomShape offers a way to specify element's shape with a sequence of points and curves using code or the design time ElementShapeEditorUITypeEditor.
Gets the internal themed control that supplies this form's visual settings.
protected RadControl ShapedControl { get; }
Gets or sets the windows related setting. Exposes API to round the form's corners on Windows 11. Using the rounded corners API with form's shapes that are not rectangular may lead to unexpected results.
public WindowsSettings WindowsSettings { get; set; }
Methods
Applies the new application theme when the notification includes a theme name.
protected virtual void ApplicationThemeChanged(object sender, ThemeChangedEventArgs args)
The source of the theme-change notification.
argsThemeChangedEventArgsThe notification containing the new theme name.
When a shape is set, rebuilds the border paths and window region; round rectangles use a native rounded region.
protected virtual void ApplyShape()
Applies the theme to the internal control and refreshes the form's non-client frame.
protected virtual void ApplyTheme(string themeName)
The theme name to apply.
Creates the border outline from the current shape and form bounds.
protected virtual GraphicsPath CreateBorderPath()
The graphics path used to paint the shaped form's border.
Clean up any resources being used.
protected override void Dispose(bool disposing)
true if managed resources should be disposed; otherwise, false.
Overrides:
Maps border and caption points to the Windows non-client hit-test codes used for resizing and moving.
Determines whether the current shape is a RoundRectShape that can use a native rounded region.
Initializes optional DWM composition and monitor-DPI state when the form loads.
Applies deferred DPI scaling once the form is fully within its destination screen.
Paints the shaped form frame instead of the standard rectangular background.
protected override void OnPaintBackground(PaintEventArgs e)
The paint event data.
Overrides:
Marks the form as moving or resizing so DPI changes can be deferred until the operation ends.
protected override void OnResizeBegin(EventArgs e)
The event data.
Overrides:
Ends the move/resize state and applies any deferred DPI scaling.
Applies the configured Windows rounded-corner setting after the form is shown.
Rebuilds the shape geometry and repaints the frame after the form size changes.
protected override void OnSizeChanged(EventArgs e)
The event data.
Overrides:
Handles theme change events to update the form's appearance.
public void OnThemeChanged(ThemeChangedEventArgs e)
The theme changed event arguments.
Implements:
When the border width is positive, paints the configured path or a rectangular fallback.
protected virtual void PaintBorder(Graphics g)
The graphics surface used to paint the border.
Paints the frame background and border; composition mode skips border drawing when the form has a native border.
protected virtual void PaintFrame(Graphics g)
The graphics surface used to paint the frame.
Scales the form only when Telerik DPI scaling is enabled.
protected override void ScaleControl(SizeF factor, BoundsSpecified specified)
The scaling factors to apply.
specifiedBoundsSpecifiedIndicates which bounds values are being scaled.
Overrides:
Limits size changes in the designer while the form's client size is being updated.
protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
The requested horizontal position.
yintThe requested vertical position.
widthintThe requested width.
heightintThe requested height.
specifiedBoundsSpecifiedIndicates which bounds values are being applied.
Overrides:
Handles non-client painting and hit testing for shaped forms, along with DPI and taskbar-window messages.
protected override void WndProc(ref Message m)
The Windows message to process.
Overrides: