Skip to main content
A newer version of this page is available. .

XtraTabControl.TabMiddleClick Event

Fires when an end-user presses the middle mouse button over a tab. To ensure that this event fires, set the XtraTabControl.TabMiddleClickFiringMode property to MouseDown or MouseUp.

Namespace: DevExpress.XtraTab

Assembly: DevExpress.XtraEditors.v19.1.dll

Declaration

[DXCategory("Behavior")]
public event PageEventHandler TabMiddleClick

Event Data

The TabMiddleClick event's data class is DevExpress.XtraTab.ViewInfo.PageEventArgs.

Remarks

By default, the TabMiddleClick event doesn’t fire. To make it fire, set the XtraTabControl.TabMiddleClickFiringMode property to MouseDown or MouseUp.

You can handle the TabMiddleClick event to perform custom actions on tabs when clicking them with the middle mouse button. For instance, you can close tabs.

Example

This example shows how to close tab pages on clicking the middle mouse button. This is accomplished by setting the XtraTabControl.TabMiddleClickFiringMode property to MouseDown and handling the XtraTabControl.TabMiddleClick event.

private void Form1_Load(object sender, EventArgs e) {
    xtraTabControl1.TabMiddleClickFiringMode = DevExpress.XtraTab.TabMiddleClickFiringMode.MouseDown;
}

private void xtraTabControl1_TabMiddleClick(object sender, DevExpress.XtraTab.ViewInfo.PageEventArgs e) {
    xtraTabControl1.TabPages.Remove((XtraTabPage)e.Page);
}
See Also