WinForms

Code Examples Upgrade Guide User Guide Demos Support Forums Download
  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class AutoLabel

    Show / Hide Table of Contents

    Class AutoLabel

    Represents a AutoLabel control with advanced customization options on background, text, and border etc.

    Inheritance
    System.Object
    AutoLabel
    Implements
    IThemeProvider
    IVisualStyle
    Namespace: Syncfusion.Windows.Forms.Tools
    Assembly: Syncfusion.Shared.Base.dll
    Syntax
    public class AutoLabel : Label, IThemeProvider, IVisualStyle
    Remarks

    Once a control is labeled by an instance of AutoLabel (through the LabeledControl property, the label gets moved around as the labeled control moves around automatically, preserving the relative positions. The relative positions can also be configured to be left, top or custom through the Position property.

    Note that the FlowLayout manager will treat the label and its control as a pair, always laying them out together as if they were one single control.

    Examples
    using System.Windows.Forms;
    namespace AutoLabel
    {
        public partial class Form1 : Form
        {
            private Syncfusion.Windows.Forms.Tools.AutoLabel autoLabel1;
            public Form1()
            {
                InitializeComponent();
                //Initialization
                this.autoLabel1 = new Syncfusion.Windows.Forms.Tools.AutoLabel();
                //Set the properties
                this.autoLabel1.Text = "autoLabel1";
                this.autoLabel1.BackColor = System.Drawing.Color.DarkGray;
                this.autoLabel1.ForeColor = System.Drawing.Color.DarkBlue;
                this.autoLabel1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.autoLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
                // Add the AutoLabel control to the form.
                this.Controls.Add(this.autoLabel1);
            }
        }
    }

    Constructors

    AutoLabel()

    Initializes a new instance of the AutoLabel class.

    Declaration
    public AutoLabel()

    Properties

    AutoSize

    Gets or sets a value indicating whether the control is automatically resized to display its entire contents.

    Declaration
    public override bool AutoSize { get; set; }
    Property Value
    Type Description
    System.Boolean
    See Also
    LabeledControl
    Position

    CanApplyTheme

    Gets or sets a value indicating whether a SkinManager ThemeStyle. has been applied to the control.

    Declaration
    public bool CanApplyTheme { get; set; }
    Property Value
    Type Description
    System.Boolean

    The default value is true.

    See Also
    ThemeName

    CanOverrideStyle

    Gets or sets a value indicating whether control elements styles can be overridden by ThemeStyle settings.

    Declaration
    public bool CanOverrideStyle { get; set; }
    Property Value
    Type Description
    System.Boolean

    Default value is false.

    Remarks

    By default, the control's element styles will not be overridden by ThemeStyle settings if the style is set in sample level. If this property is enabled, element style will be overridden by ThemeStyle settings event if it is set in sample level. This property should be enabled or disabled before calling the ThemeName property of the control.

    See Also
    ThemeName
    AutoLabelStyle

    DX

    Gets or sets the effective horizontal distance between the left of the AutoLabel and its labeled control.

    Declaration
    public int DX { get; set; }
    Property Value
    Type Description
    System.Int32
    Remarks

    When System.Windows.Forms.RightToLeft == System.Windows.Forms.RightToLeft.Yes DX is the distance between the right of the labeled control and the right of the AutoLabel.

    See Also
    AutoSize
    Position
    LabeledControl
    Gap
    DY

    DY

    Gets or sets the effective vertical distance between the top of the AutoLabel and its labeled control.

    Declaration
    public int DY { get; set; }
    Property Value
    Type Description
    System.Int32
    See Also
    AutoSize
    Position
    LabeledControl
    DX
    Syncfusion.Windows.Forms.Tools.AutoLabel.gap

    Enabled

    Gets or sets the AutoLabel control is enabled.

    Declaration
    public bool Enabled { get; set; }
    Property Value
    Type Description
    System.Boolean
    See Also
    VisualStyle
    IsVisualStyleEnabled

    Font

    Declaration
    public override Font Font { get; set; }
    Property Value
    Type Description
    System.Drawing.Font

    Gap

    Gets or sets the horizontal and vertical gap to use when computing the relative position.

    Declaration
    public int Gap { get; set; }
    Property Value
    Type Description
    System.Int32
    See Also
    AutoSize
    Position
    LabeledControl
    DX
    DY

    IsVisualStyleEnabled

    Gets a value indicating whether the visual style based theme is applied to the control and also indicates whether the theme files are referred from external assemblies or not.

    Declaration
    public bool IsVisualStyleEnabled { get; }
    Property Value
    Type Description
    System.Boolean

    Return true, if the visual style based theme is applied to the control. Otherwise returns false.

    See Also
    ThemeName
    CanOverrideStyle

    LabeledControl

    Gets or sets the control that is being labeled.

    Declaration
    public Control LabeledControl { get; set; }
    Property Value
    Type Description
    System.Windows.Forms.Control

    A control instance.

    Position

    Gets or sets the relative position of the control and the AutoLabel.

    Declaration
    public AutoLabelPosition Position { get; set; }
    Property Value
    Type Description
    AutoLabelPosition
    See Also
    AutoSize
    LabeledControl

    PreferredHeight

    Declaration
    public override int PreferredHeight { get; }
    Property Value
    Type Description
    System.Int32

    Style

    Gets or sets the VisualStyle to the AutoLabel.

    Declaration
    public AutoLabelStyle Style { get; set; }
    Property Value
    Type Description
    AutoLabelStyle
    See Also
    ThemeName

    ThemeName

    Gets or sets the theme name of the AutoLabel control.

    Declaration
    public string ThemeName { get; set; }
    Property Value
    Type Description
    System.String

    ThemeStyle

    Gets or sets the AutoLabelVisualStyle value used to customize the appearance of the .

    Declaration
    public AutoLabelVisualStyle ThemeStyle { get; set; }
    Property Value
    Type Description
    AutoLabelVisualStyle
    Remarks

    This ThemeStyle settings will be applied only when the VisualStyleBased theme has been applied to the control.

    Methods

    Dispose(Boolean)

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing

    GetActiveThemeName()

    Gets the active theme name of the AutoLabel control.

    Declaration
    public string GetActiveThemeName()
    Returns
    Type Description
    System.String

    Returns the active theme name.

    OnAttachLabeledControl(Control)

    Called when a new control is getting labeled (when set through the LabeledControl property.

    Declaration
    protected virtual void OnAttachLabeledControl(Control labeledControl)
    Parameters
    Type Name Description
    System.Windows.Forms.Control labeledControl

    The control that is being labeled.

    OnDetachLabeledControl(Control)

    Called when an exisiting label is getting unlabeled.

    Declaration
    protected virtual void OnDetachLabeledControl(Control labeledControl)
    Parameters
    Type Name Description
    System.Windows.Forms.Control labeledControl

    The control that is being unlabeled.

    OnFontChanged(EventArgs)

    Font changed

    Declaration
    protected override void OnFontChanged(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e

    OnLocationChanged(EventArgs)

    Declaration
    protected override void OnLocationChanged(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e

    OnParentRightToLeftChanged(EventArgs)

    Declaration
    protected override void OnParentRightToLeftChanged(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e

    OnPropertyChanged(SyncfusionPropertyChangedEventArgs)

    Raises the PropertyChanged event.

    Declaration
    protected virtual void OnPropertyChanged(SyncfusionPropertyChangedEventArgs e)
    Parameters
    Type Name Description
    SyncfusionPropertyChangedEventArgs e

    An System.EventArgs object containing data pertaining to this event.

    Remarks

    The OnPropertyChanged method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

    Note to Inheritors: When overriding OnPropertyChanged in a derived class, be sure to call the base class's OnPropertyChanged method so that registered delegates receive the event.

    OnRightToLeftChanged(EventArgs)

    Declaration
    protected override void OnRightToLeftChanged(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e

    OnSizeChanged(EventArgs)

    Declaration
    protected override void OnSizeChanged(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e

    SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified)

    Sets the specified bounds of the label.

    Declaration
    protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
    Parameters
    Type Name Description
    System.Int32 x
    System.Int32 y
    System.Int32 width
    System.Int32 height
    System.Windows.Forms.BoundsSpecified specified

    UpdatePosition()

    Updates the position of the AutoLabel when the parameters that affect the relative positions have changed (like the LabeledControl's position, size, etc.).

    Declaration
    protected virtual void UpdatePosition()

    WndProc(ref Message)

    Processes Windows messages.

    Declaration
    protected override void WndProc(ref Message m)
    Parameters
    Type Name Description
    System.Windows.Forms.Message m

    The Windows System.Windows.Forms.Message to process.

    Events

    PropertyChanged

    Fired when the LabeledControl Control, Gap and Position properties of this class changes.

    Declaration
    public event SyncfusionPropertyChangedEventHandler PropertyChanged
    Event Type
    Type Description
    SyncfusionPropertyChangedEventHandler

    ThemeNameChanged

    Occurs when theme name of the AutoLabel has changed.

    Declaration
    public event ThemeChangedEventHandler ThemeNameChanged
    Event Type
    Type Description
    ThemeChangedEventHandler

    Explicit Interface Implementations

    IVisualStyle.VisualTheme

    Declaration
    string IVisualStyle.VisualTheme { get; set; }
    Returns
    Type Description
    System.String

    IThemeProvider.BaseThemeName

    Gets or sets the BaseTheme name of the theme

    Declaration
    string IThemeProvider.BaseThemeName { get; set; }
    Returns
    Type Description
    System.String

    IThemeProvider.ControlName

    Gets the name of the control.

    Declaration
    string IThemeProvider.ControlName { get; }
    Returns
    Type Description
    System.String

    Implements

    IThemeProvider
    IVisualStyle
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved