'宣言 Public Class PaneButtonEventArgs Inherits System.EventArgs
public class PaneButtonEventArgs : System.EventArgs
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinDock Private Sub ultraDockManager1_BeforePaneButtonClick(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinDock.CancelablePaneButtonEventArgs) Handles ultraDockManager1.BeforePaneButtonClick ' The BeforePaneButtonClick event is invoked when the ' user clicks a pane caption button but before the ' associated action is invoked. The Button parameter ' of the event args indicates the button that was clicked. ' The associated action may be prevented by setting the ' Cancel parameter to false. ' ' You can prevent a pane button's action from being invoked ' by setting the cancel parameter to true. ' If (e.Button = PaneButton.Close) Then Dim dr As DialogResult = MessageBox.Show(Me, _ "Are you sure you want to close this pane?", _ Application.ProductName, _ MessageBoxButtons.YesNo, _ MessageBoxIcon.Question) If (dr = DialogResult.No) Then e.Cancel = True End If End If End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinDock; using System.Diagnostics; private void ultraDockManager1_BeforePaneButtonClick(object sender, Infragistics.Win.UltraWinDock.CancelablePaneButtonEventArgs e) { // The BeforePaneButtonClick event is invoked when the // user clicks a pane caption button but before the // associated action is invoked. The Button parameter // of the event args indicates the button that was clicked. // The associated action may be prevented by setting the // Cancel parameter to false. // // You can prevent a pane button's action from being invoked // by setting the cancel parameter to true. // if (e.Button == PaneButton.Close) { DialogResult dr = MessageBox.Show(this, "Are you sure you want to close this pane?", Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.No) e.Cancel = true; } }