Back to Devexpress

CharacterCombBrick Class

corelibraries-devexpress-dot-xtraprinting-8ef6c895.md

latest6.4 KB
Original Source

CharacterCombBrick Class

A visual brick containing text whose characters are displayed in individual cells.

Namespace : DevExpress.XtraPrinting

Assembly : DevExpress.Printing.v25.2.Core.dll

NuGet Package : DevExpress.Printing.Core

Declaration

csharp
[BrickExporter(typeof(CharacterCombBrickExporter))]
public class CharacterCombBrick :
    TextBrickBase
vb
<BrickExporter(GetType(CharacterCombBrickExporter))>
Public Class CharacterCombBrick
    Inherits TextBrickBase

Remarks

The CharacterCombBrick class allows you to display characters in separate cells in a document.

Use the CharacterCombBrick.CellVerticalSpacing and CharacterCombBrick.CellHorizontalSpacing properties to specify the spacing between adjacent cells.

The CharacterCombBrick.CellSizeMode property defines how and whether the cell size should depend on the current font size.

SizeModeDescription
AutoSizeThe cell size depends on the current font size .
AutoWidthOnly the cell width depends on the current font size (the CharacterCombBrick.CellWidth property is ignored), and the CharacterCombBrick.CellHeight value is specified manually.
AutoHeightOnly the cell height depends on the current font size (the CharacterCombBrick.CellHeight property is ignored), and the CharacterCombBrick.CellWidth value is specified manually.
CustomThe cell size is determined by the CharacterCombBrick.CellHeight and CharacterCombBrick.CellWidth property values and does not depend on the assigned font size.

The following example demonstrates how to draw the CharacterCombBrick in the document.

csharp
using System;
using System.Drawing;
using System.Windows.Forms;
using DevExpress.XtraPrinting;

public partial class Form1 : Form {
    PrintingSystem printingSystem = new PrintingSystem();

    public Form1() {
        InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e) {
        documentViewer1.PrintingSystem = printingSystem;
    }

    private void btnDrawCharacterComb_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) {
        // Prepare for creating a document.
        printingSystem.Begin();
        BrickGraphics gr = printingSystem.Graph;
        gr.Modifier = BrickModifier.Detail;

        // Create a new brick instance.
        CharacterCombBrick brick = new CharacterCombBrick();

        // Set the brick's static text and specify its size. 
        brick.Text = "First Name";
        brick.Rect = new RectangleF(0, 0, 200, 150);

        // Specify the cell width and height.
        brick.CellSizeMode = SizeMode.Custom;
        brick.CellWidth = 100;
        brick.CellHeight = 100;

        // Specify the spacing between cells.        
        brick.CellHorizontalSpacing = 10;
        brick.CellVerticalSpacing = 10;

        // Draw this brick.
        gr.DrawBrick(brick);

        // Finish creating the document.
        printingSystem.End();
    }
}
vb
Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports DevExpress.XtraPrinting

Public Partial Class Form1
    Inherits Form

    Private printingSystem As PrintingSystem = New PrintingSystem()

    Public Sub New()
        InitializeComponent()
    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
        documentViewer1.PrintingSystem = printingSystem
    End Sub

    Private Sub btnDrawCharacterComb_ItemClick(ByVal sender As Object, ByVal e As DevExpress.XtraBars.ItemClickEventArgs)
        ' Prepare for creating a document.
        printingSystem.Begin()
        Dim gr As BrickGraphics = printingSystem.Graph
        gr.Modifier = BrickModifier.Detail

        ' Create a new brick instance.
        Dim brick As CharacterCombBrick = New CharacterCombBrick()

        ' Set the brick's static text and specify its size. 
        brick.Text = "First Name"
        brick.Rect = New RectangleF(0, 0, 200, 150)

        ' Specify the cell width and height.
        brick.CellSizeMode = SizeMode.Custom
        brick.CellWidth = 100
        brick.CellHeight = 100

        ' Specify the spacing between cells.    
        brick.CellHorizontalSpacing = 10
        brick.CellVerticalSpacing = 10

        ' Draw this brick.
        gr.DrawBrick(brick)

        ' Finish creating the document.
        printingSystem.End
    End Sub
End Class

Implements

IXtraSupportDeserializeCollectionItem

ITableCell

IBrick

Inheritance

Object DevExpress.Printing.Utils.DocumentStoring.StorableObjectBase BrickBase Brick VisualBrick TextBrickBase CharacterCombBrick

See Also

CharacterCombBrick Members

DevExpress.XtraPrinting Namespace