Skip to main content

PrintControl.BrickClick Event

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

Namespace: DevExpress.XtraPrinting.Control

Assembly: DevExpress.XtraPrinting.v24.1.dll

NuGet Packages: DevExpress.Win.Navigation, DevExpress.Win.Printing

Declaration

public event BrickEventHandler BrickClick

Event Data

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

Property Description
Args Returns an object storing the event arguments.
Brick Gets a brick for which an event has been raised. Inherited from BrickEventArgsBase.
BrickScreenBounds Returns the rectangle displayed when clicking a brick.
Page Returns the document page containing the brick for which the corresponding event was fired.
X Returns the horizontal mouse position within a brick.
Y Returns 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.

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);
    }
}
See Also