xtrareports-devexpress-dot-xtrareports-dot-ui-dot-checkboxglyphoptions.md
Gets or sets the glyph alignment within a control. Near to align to the left; Center to align to the center; Far to align to the right.
Namespace : DevExpress.XtraReports.UI
Assembly : DevExpress.XtraReports.v25.2.dll
NuGet Package : DevExpress.Reporting.Core
[DefaultValue(HorzAlignment.Near)]
public HorzAlignment Alignment { get; set; }
<DefaultValue(HorzAlignment.Near)>
Public Property Alignment As HorzAlignment
| Type | Default | Description |
|---|---|---|
| HorzAlignment | Near |
The glyph alignment within a control
|
Available values:
| Name | Description |
|---|---|
| Default |
Places an object or text at the default position, which is determined by a control.
| | Near |
Places an object/text at a near position.
| | Center |
Centers an object or text within a region.
| | Far |
Places an object/text at a far position.
|
You can access this nested property as listed below:
| Object Type | Path to Alignment |
|---|---|
| XRCheckBox |
.GlyphOptions .Alignment
|
The checkbox does not display its caption when the Alignment property is set to the HorzAlignment.Center value.
The code sample below illustrates how to create a checkbox with the glyph aligned to the right.
using DevExpress.XtraReports.UI;
using DevExpress.XtraPrinting.Drawing;
using DevExpress.XtraPrinting;
// ...
public XRCheckBox CreateXRCheckBox() {
// Create an XRCheckBox object.
XRCheckBox xrCheckBox1 = new XRCheckBox();
// Set the glyph size
xrCheckBox1.GlyphOptions.Size = new SizeF(18, 18);
// Set the glyph style
xrCheckBox1.GlyphOptions.Style = DevExpress.XtraPrinting.GlyphStyle.Thumb;
// Align the glyph to the right
xrCheckBox1.GlyphOptions.Alignment = DevExpress.Utils.HorzAlignment.Far;
// Add a glyph image for the Checked state
xrCheckBox1.GlyphOptions.CustomGlyphs[CheckBoxState.Checked] = ImageSource.FromFile(".\\checkbox-checked.svg");
// Add a glyph image for the Unchecked state
xrCheckBox1.GlyphOptions.CustomGlyphs[CheckBoxState.Unchecked] = ImageSource.FromFile(".\\checkbox-unchecked.svg");
// Add a glyph image for the Indeterminate state
xrCheckBox1.GlyphOptions.CustomGlyphs[CheckBoxState.Indeterminate] = ImageSource.FromFile(".\\checkbox-indeterminate.svg");
return xrCheckBox1;
}
Imports DevExpress.XtraReports.UI
Imports DevExpress.XtraPrinting.Drawing
Imports DevExpress.XtraPrinting
' ...
Public Function CreateXRCheckBox() As XRCheckBox
' Create an XRCheckBox object.
Dim xrCheckBox1 As New XRCheckBox()
' Set the glyph size
xrCheckBox1.GlyphOptions.Size = New SizeF(18, 18)
' Set the glyph style
xrCheckBox1.GlyphOptions.Style = DevExpress.XtraPrinting.GlyphStyle.Thumb
' Align the glyph to the right
xrCheckBox1.GlyphOptions.Alignment = DevExpress.Utils.HorzAlignment.Far
' Add a glyph image for the Checked state
xrCheckBox1.GlyphOptions.CustomGlyphs(CheckBoxState.Checked) = ImageSource.FromFile(".\checkbox-checked.svg")
' Add a glyph image for the Unchecked state
xrCheckBox1.GlyphOptions.CustomGlyphs(CheckBoxState.Unchecked) = ImageSource.FromFile(".\checkbox-unchecked.svg")
' Add a glyph image for the Indeterminate state
xrCheckBox1.GlyphOptions.CustomGlyphs(CheckBoxState.Indeterminate) = ImageSource.FromFile(".\checkbox-indeterminate.svg")
Return xrCheckBox1
End Function
See Also