windowsforms-devexpress-dot-xtraprinting-dot-control-dot-printcontrol-43ec7dcd.md
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
public event BrickEventHandler BrickClick
Public Event BrickClick As BrickEventHandler
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. |
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);
}
}
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