Skip to main content
Version: 4.1

Label

Namespace: Wisej.Web

Assembly: Wisej.Framework (4.1.0.0)

Represents a label control.

public class Label : Control, IButtonControl, IImage, IErrorProvider, ICommandSource

Constructors

Instance member Label()

Initializes a new instance of the Label class.

Instance member Label(text)

Initializes a new instance of the Label class.

NameTypeDescription
textStringInitial text.

Instance member Label(text, location, size)

Initializes a new instance of the Label class.

NameTypeDescription
textStringInitial text.
locationPointInitial location.
sizeSizeInitial size.

Properties

Instance member AllowHtml

Boolean: Returns or sets a value indicating that the control can display HTML in the Text property. (Default: False)

Newlines (CRLF) are converted to <BR/> when AllowHtml is false, or when AllowHtml is true and the text doesn't contain any HTML.

Instance member AllowMarkdown

Boolean: Returns or sets a value indicating that the control can display markdown text as HTML in the Text property. (Default: False)

Instance member Anchor

AnchorStyles: Returns or sets the edges of the container to which a control is bound and determines how a control is resized with its parent. (Default: Top, Left)

Instance member AutoEllipsis

Boolean: Returns or sets whether the ellipsis character (...) appears at the right edge of the label, denoting that the text extends beyond the size of the label. (Default: False)

Instance member AutoSize

Boolean: Returns or sets a value that indicates whether the control resizes based on its contents. (Default: False)

Since 3.5.6

Auto sizing behavior in the Label control is slightly different from other controls. When the label is a child of a standard container (i.e. Panel, Form, Page, GroupBox) and it's anchored to the right, auto sizing grows or shrinks the label's width preserving the left position.

When the label is a child of a container with a custom LayoutEngine (i.e. FlexLayoutPanel, FlowLayoutPanel, TableLayoutPanel) the auto sizing behavior is the same as all other controls.

You can change the default behavior using the AppContext switch "LabelSelfSize". See System.AppContext to learn how to set the switch. In code, you can set it in a static Program constructor:


class Program {
static void Program() {
AppContext.SetSwitch("LabelSelfSize", false);
}
}

Instance member AutoToolTip

Boolean: Returns or sets whether a tooltip is displayed when the text extends beyond the size of the label. (Default: False)

The auto tooltip is set on the browser using the title attribute managed by the browser, does not use the themed tooltip managed by Wisej.NET.

Instance member BorderStyle

BorderStyle: Indicates the border style for the control. (Default: None)

Instance member CharacterCasing

CharacterCasing: Returns or sets the case of the text to display to the user. (Default: Normal)

Instance member Command

ICommand: Returns or sets the ICommand implementation to invoke. (Default: null)

Protected member DefaultSize

Size:

Instance member DialogResult

DialogResult: Returns or sets a value that is returned to the parent form when the button is clicked. (Default: None)

Instance member Dock

DockStyle: Returns or sets which control borders are docked to its parent control and determines how a control is resized with its parent. (Default: None)

Instance member EnableNativeContextMenu

Boolean: Enables or disables the browser's context menu. (Default: False)

Instance member Image

Image: Returns or sets the image that is displayed on a Label.

Instance member ImageAlign

ContentAlignment: Returns or sets the alignment of an image that is displayed in the control. (Default: MiddleCenter)

Instance member ImageIndex

Int32: Returns or sets the image list index value of the image displayed on the label control. (Default: -1)

Throws:

Instance member ImageKey

String: Returns or sets the key accessor for the image in the ImageList. (Default: "")

Instance member ImageList

ImageList: Returns or sets the ImageList that contains the images to display in the Label control. (Default: null)

Instance member ImageSource

String: Returns or sets the theme name or URL for the image to display in the Label.

Instance member SelfSize

Boolean: Returns or sets whether the label resize itself when AutoSize is true and it's in a container using the default layout engine: i.e.: Panel, Form, Page, GroupBox, UserControl. Since 3.5.6 (Default: True)

When self sizing is active (default for standard containers) an auto sizing label will always grow to the right side, even when anchored right, preserving it's left position. This is the default behavior in WinForms applications.

Static member SelfSizeDefault

Boolean: Default value for the SelfSize property. Since 3.5.6

The default is true. You can set the value by code or using AppContext switches: AppContext.SetSwitch("LabelSelfSize", false);

Instance member Text

String: Returns or sets the text associated with this control. (Default: "")

Newlines (CRLF) are converted to <BR/> when AllowHtml is false, or when AllowHtml is true and the text doesn't contain any HTML.

Instance member TextAlign

ContentAlignment: Returns or sets the alignment of text in the label. (Default: TopLeft)

Instance member UseMnemonic

Boolean: Returns or sets whether the first character that is preceded by an ampersand (&) is used as the mnemonic key of the control. (Default: True)

Methods

Protected member OnClick(e)

Fires the Click event.

ParameterTypeDescription
eEventArgsAn EventArgs that contains the event data.

Protected member OnCommandChanged(e)

Fires the CommandChanged event.

ParameterTypeDescription
eEventArgsA EventArgs that contains the event data.

Protected member OnFontChanged(e)

ParameterTypeDescription
eEventArgs

Protected member OnParentChanged(e)

ParameterTypeDescription
eEventArgs

Protected member OnTextChanged(e)

ParameterTypeDescription
eEventArgs

Protected member OnWebEvent(e)

Processes the event from the client.

ParameterTypeDescription
eWisejEventArgsEvent arguments.

Protected member OnWebRender(config)

Renders the client component.

ParameterTypeDescription
configObjectDynamic configuration object.

Instance member PerformClick()

Generates a Click event for the LinkLabel control.

Protected member SetBoundsCore(x, y, width, height, specified)

Sets the specified bounds of the label.

ParameterTypeDescription
xInt32The new Left property value of the control.
yInt32The new Top property value of the control.
widthInt32The new Width property value of the control.
heightInt32The new Height property value of the control.
specifiedBoundsSpecifiedA bitwise combination of the BoundsSpecified values. For any parameter not specified, the current value will be used.

Events

Instance member CommandChanged

EventHandler Fired when the Command property value changes.

Inherited By

NameDescription
LinkLabelRepresents an hyper-link control.

Implements

NameDescription
IUserDataProvides access to the UserData and Tag properties associated to the component implementing this interface.
IBindableComponentBindable components implement this interface.
IButtonControlAllows a control to act like a button on a Form.
ICommandSourceDefines an object that can invoke a Command.
IDropTargetControls that support drag & drop operations implement this interface.
IErrorProviderExposes a common api implemented by components that can collect errors in relation to a Control.
IImageProvides access to common image properties across the controls that implement this interface.
IWisejComponentAll wisej components implement this interface.
IWisejControlAll wisej controls derived from the Control class must implement this interface.
IWisejSerializableAllows an object to serialize itself.