Back to Devexpress

PrintControl.BrickClick Event

windowsforms-devexpress-dot-xtraprinting-dot-control-dot-printcontrol-43ec7dcd.md

latest3.9 KB
Original Source

PrintControl.BrickClick Event

Occurs when the region of a brick within the PrintControl is clicked.

Namespace : DevExpress.XtraPrinting.Control

Assembly : DevExpress.XtraPrinting.v25.2.dll

NuGet Package : DevExpress.Win.Printing

Declaration

csharp
public event BrickEventHandler BrickClick
vb
Public Event BrickClick As BrickEventHandler

Event Data

The BrickClick event's data class is BrickEventArgs. The following properties provide information specific to this event:

PropertyDescription
ArgsReturns an object storing the event arguments.
BrickGets a brick for which an event has been raised. Inherited from BrickEventArgsBase.
BrickScreenBoundsReturns the rectangle displayed when clicking a brick.
PageReturns the document page containing the brick for which the corresponding event was fired.
XReturns the horizontal mouse position within a brick.
YReturns the vertical mouse position within a brick.

Example

This example illustrates how to change the background color of a brick after clicking it in Print Preview by handling the PrintControl.BrickClick event of PrintControl.

For the changes to take effect, call the PrintControl.InvalidateBrick method to update the document area occupied by the brick.

csharp
using DevExpress.XtraPrinting.Control;
// ...

private void printControl1_BrickClick(object sender, BrickEventArgs e) {
    if (e.Brick as VisualBrick != null) {
        // Change the background color.
        (e.Brick as VisualBrick).BackColor = Color.Red;

        // Redraw the brick.
        this.printControl1.InvalidateBrick(e.Brick);
    }
}
vb
Imports DevExpress.XtraPrinting.Control
' ...

Private Sub printControl1_BrickClick(ByVal sender As Object, ByVal e As BrickEventArgs) _
Handles printControl1.BrickClick

    If TryCast(e.Brick, VisualBrick) IsNot Nothing Then
        ' Change the background color.
        CType(e.Brick, VisualBrick).BackColor = Color.Red

        ' Redraw the brick.
        Me.printControl1.InvalidateBrick(e.Brick)
    End If

End Sub

See Also

PrintControl Class

PrintControl Members

DevExpress.XtraPrinting.Control Namespace