Class ImageAndTextLayoutPanel
Represents a specialized layout panel that arranges two child elements (an image element and a text element) with configurable positioning and alignment.
Inherited Members
Namespace: Telerik.WinControls.Layouts
Assembly: Telerik.WinControls.dll
Syntax
public class ImageAndTextLayoutPanel : LayoutPanel, IDisposable, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IStylableNode
Remarks
ImageAndTextLayoutPanel extends LayoutPanel to provide sophisticated layout capabilities specifically designed for image and text combinations commonly found in buttons, menu items, list items, and similar UI elements. The panel can arrange the image and text in various spatial relationships such as side-by-side, stacked, or overlaid configurations.
The layout panel supports different display styles including image-only, text-only, or combined image and text display. Each element can be independently aligned within its allocated space using standard System.Drawing.ContentAlignment values, and their relative positioning is controlled through the TextImageRelation property.
This layout panel is commonly used in controls like buttons, toolstrip items, menu items, and tree nodes where consistent image and text arrangement is required across multiple instances.
Constructors
ImageAndTextLayoutPanel()
Declaration
public ImageAndTextLayoutPanel()
Fields
DisplayStyleProperty
ImageAlignmentProperty
IsImagePrimitiveProperty
IsTextPrimitiveProperty
TextAlignmentProperty
TextImageRelationProperty
Properties
DisplayStyle
Gets or sets which elements should be displayed in the layout panel.
Declaration
[RadPropertyDefaultValue("DisplayStyle", typeof(ImageAndTextLayoutPanel))]
public DisplayStyle DisplayStyle { get; set; }
Property Value
DisplayStyle
A DisplayStyle value that determines which elements are visible. The default value is ImageAndText. |
Remarks
This property controls the visibility of the image and text elements:
- None: Neither image nor text is displayed
- Image: Only the image element is displayed
- Text: Only the text element is displayed
- ImageAndText: Both image and text elements are displayed
The layout calculations automatically adjust based on which elements are visible.
ImageAlignment
Gets or sets the alignment of the image element within its allocated space.
Declaration
[RadPropertyDefaultValue("ImageAlignment", typeof(ImageAndTextLayoutPanel))]
public ContentAlignment ImageAlignment { get; set; }
Property Value
System.Drawing.ContentAlignment
A System.Drawing.ContentAlignment value that specifies where the image should be positioned. The default value is System.Drawing.ContentAlignment.MiddleLeft. |
Remarks
This property determines how the image element is positioned within the space allocated to it by the layout calculation. The alignment is relative to the image's designated area, not the entire panel.
TextAlignment
Gets or sets the alignment of the text element within its allocated space.
Declaration
[RadPropertyDefaultValue("TextAlignment", typeof(ImageAndTextLayoutPanel))]
public ContentAlignment TextAlignment { get; set; }
Property Value
System.Drawing.ContentAlignment
A System.Drawing.ContentAlignment value that specifies where the text should be positioned. The default value is System.Drawing.ContentAlignment.MiddleLeft. |
Remarks
This property determines how the text element is positioned within the space allocated to it by the layout calculation. The alignment is relative to the text's designated area, not the entire panel.
TextImageRelation
Gets or sets the spatial relationship between the image and text elements.
Declaration
[RadPropertyDefaultValue("TextImageRelation", typeof(ImageAndTextLayoutPanel))]
public TextImageRelation TextImageRelation { get; set; }
Property Value
System.Windows.Forms.TextImageRelation
A System.Windows.Forms.TextImageRelation value that specifies how the image and text should be positioned relative to each other. The default value is System.Windows.Forms.TextImageRelation.Overlay. |
Remarks
This property controls the fundamental layout relationship between the image and text elements:
- System.Windows.Forms.TextImageRelation.ImageAboveText: Image is positioned above the text
- System.Windows.Forms.TextImageRelation.ImageBeforeText: Image is positioned to the left of the text
- System.Windows.Forms.TextImageRelation.TextAboveImage: Text is positioned above the image
- System.Windows.Forms.TextImageRelation.TextBeforeImage: Text is positioned to the left of the image
- System.Windows.Forms.TextImageRelation.Overlay: Image and text overlap in the same space
Methods
ArrangeOverride(SizeF)
Declaration
protected override SizeF ArrangeOverride(SizeF finalSize)
Parameters
System.Drawing.SizeF
finalSize
|
Returns
System.Drawing.SizeF
|
Overrides
DisposeManagedResources()
Declaration
protected override void DisposeManagedResources()
Overrides
MeasureOverride(SizeF)
Declaration
protected override SizeF MeasureOverride(SizeF availableSize)
Parameters
System.Drawing.SizeF
availableSize
|
Returns
System.Drawing.SizeF
|
Overrides
OnChildrenChanged(RadElement, ItemsChangeOperation)
Declaration
protected override void OnChildrenChanged(RadElement child, ItemsChangeOperation changeOperation)
Parameters
RadElement
child
|
ItemsChangeOperation
changeOperation
|
Overrides
OnLoaded()
OnPropertyChanged(RadPropertyChangedEventArgs)
Declaration
protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
Parameters
RadPropertyChangedEventArgs
e
|