Back to Devexpress

CheckBoxGlyphOptions.CustomGlyphs Property

xtrareports-devexpress-dot-xtrareports-dot-ui-dot-checkboxglyphoptions-2632f720.md

latest5.9 KB
Original Source

CheckBoxGlyphOptions.CustomGlyphs Property

Specifies a custom glyph image for each checkbox state.

Namespace : DevExpress.XtraReports.UI

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

csharp
public CheckBoxGlyphs CustomGlyphs { get; }
vb
Public ReadOnly Property CustomGlyphs As CheckBoxGlyphs

Property Value

TypeDescription
CheckBoxGlyphs

Custom glyph images for each checkbox state

|

Property Paths

You can access this nested property as listed below:

Object TypePath to CustomGlyphs
XRCheckBox

.GlyphOptions .CustomGlyphs

|

Remarks

When there is no custom glyph image for a checkbox state, the control displays a glyph image specified by the Style property.

Design time

Visual Studio Report Designer

When you specify custom glyphs in Visual Studio at design time, the Image Picker is invoked. It allows you to set a custom glyph image or choose an glyph image from the DevExpress Image Library.

Visual Studio Image Chooser

DevExpress Raster Image Chooser

DevExpress Vector Image Chooser

You can choose whether to add the selected glyph image to the report or project resources. If you add the glyph image to project resources, you can reuse it in several reports.

Project Resources

Report Resources

End-User Report Designer

When you specify custom glyphs in an End-User Report Designer, the Open File dialog is invoked.

The selected glyph image is saved to the report definition .repx file.

Runtime

You can set glyphs for the following checkbox states:

Use the Item[CheckBoxState] property to access the specified check state’s glyph image.

Example

The code sample below illustrates how to create a checkbox with custom glyphs.

csharp
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;
}
vb
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

CheckBoxGlyphOptions Class

CheckBoxGlyphOptions Members

DevExpress.XtraReports.UI Namespace