Partilhar via


Evento ChartSheet.SelectEvent (sistema de 2007)

Ocorre quando o Microsoft.Office.Tools.Excel.ChartSheet está selecionada.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v9.0 (em Microsoft.Office.Tools.Excel.v9.0.dll)

Sintaxe

Public Event SelectEvent As ChartEvents_SelectEventHandler

Dim instance As ChartSheet
Dim handler As ChartEvents_SelectEventHandler

AddHandler instance.SelectEvent, handler
public event ChartEvents_SelectEventHandler SelectEvent

Exemplos

O exemplo de código a seguir demonstra um manipulador para o SelectEvent caixa de evento que exibe uma mensagem quando o eixo principal do corrente Microsoft.Office.Tools.Excel.ChartSheet está selecionada.

Private Sub DisplayPrimaryAxisSelections()
    Globals.Sheet1.Range("A1", "A5").Value2 = 22
    Globals.Sheet1.Range("B1", "B5").Value2 = 55

    Me.SetSourceData(Globals.Sheet1.Range("A1", "B5"), _
        Excel.XlRowCol.xlColumns)
    Me.ChartType = Excel.XlChartType.xl3DColumn
End Sub

Sub ChartSheet1_SelectEvent(ByVal ElementID As Integer, _
    ByVal Arg1 As Integer, ByVal Arg2 As Integer) _
    Handles Me.SelectEvent

    If Excel.XlChartItem.xlAxis = _
        CType(ElementID, Excel.XlChartItem) Then
        If Excel.XlAxisGroup.xlPrimary = _
            CType(Arg1, Excel.XlAxisGroup) Then
            MsgBox("The primary axis of the chart " & _
                "sheet was selected.")
        End If
    End If
End Sub
private void DisplayPrimaryAxisSelections()
{
    Globals.Sheet1.Range["A1", "A5"].Value2 = 22;
    Globals.Sheet1.Range["B1", "B5"].Value2 = 55;

    this.SetSourceData(Globals.Sheet1.Range["A1", "B5"],
        Excel.XlRowCol.xlColumns);
    this.ChartType = Excel.XlChartType.xl3DColumn;

    this.SelectEvent +=
        new Excel.ChartEvents_SelectEventHandler(
        ChartSheet1_SelectEvent);
}

void ChartSheet1_SelectEvent(int ElementID, int Arg1, int Arg2)
{
    if (Excel.XlChartItem.xlAxis == (Excel.XlChartItem)ElementID)
    {
        if (Excel.XlAxisGroup.xlPrimary == (Excel.XlAxisGroup)Arg1)
        {
            MessageBox.Show("The primary axis of the chart " +
                "sheet was selected.");
        }
    }
}

Permissões

Consulte também

Referência

ChartSheet Classe

Membros ChartSheet

Namespace Microsoft.Office.Tools.Excel