Back to Devexpress

XRControl.PreviewClick Event

xtrareports-devexpress-dot-xtrareports-dot-ui-dot-xrcontrol-377bd2d5.md

latest4.2 KB
Original Source

XRControl.PreviewClick Event

Occurs when the mouse button is clicked while the cursor is hovering over one of the bricks created by the XRControl for its representation in the report preview.

Namespace : DevExpress.XtraReports.UI

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

csharp
public virtual event PreviewMouseEventHandler PreviewClick
vb
Public Overridable Event PreviewClick As PreviewMouseEventHandler

Event Data

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

PropertyDescription
BrickGets a visual brick that represents this control’s contents on a report page.
MouseButtonProvides access to the value that specifies which mouse button has been clicked.
PreviewControlGets the control which shows the print preview of the report for this event.

The event data class exposes the following methods:

MethodDescription
GetBrickScreenBounds()Obtains the location and size of the PreviewMouseEventArgs.Brick on the screen.

Remarks

Note

The PreviewClick event fires only for Windows Forms applications.

Use this event to perform different actions when a control is clicked while the report it is located in is being previewed.

The PreviewMouseClick event is raised along with the other events listed below in the following order:

Example

This example demonstrates how you can obtain a XRLabel‘s text in print preview, by handling its XRControl.PreviewClick or XRControl.PreviewDoubleClick events.

csharp
using System;
using System.Windows.Forms;
using DevExpress.XtraReports.UI;
// ...

private void xrLabel1_PreviewClick(object sender, PreviewMouseEventArgs e) {
    MessageBox.Show(e.Brick.Text);
}

private void xrLabel2_PreviewDoubleClick(object sender, PreviewMouseEventArgs e) {
    MessageBox.Show(e.Brick.Text);
}
vb
Imports System
Imports System.Windows.Forms
Imports DevExpress.XtraReports.UI
' ...

Private Sub xrLabel1_PreviewClick(ByVal sender As Object, _ 
ByVal e As PreviewMouseEventArgs) Handles xrLabel1.PreviewClick
    MessageBox.Show(e.Brick.Text)
End Sub

Private Sub xrLabel2_PreviewDoubleClick(ByVal sender As Object, _ 
ByVal e As PreviewMouseEventArgs) Handles xrLabel2.PreviewDoubleClick
    MessageBox.Show(e.Brick.Text)
End Sub

See Also

PreviewDoubleClick

PreviewMouseDown

PreviewMouseMove

PreviewMouseUp

XRControl Class

XRControl Members

DevExpress.XtraReports.UI Namespace