User control that implements the NodeXL custom task pane.
This Excel 2007 custom task pane contains a NodeXLControl that displays a NodeXL graph, along with controls for manipulating the graph. It utilizes the task pane support provided by Visual Studio 2005 Tools for the Office System SE.
Inheritance: System.Windows.Forms.UserControl
コード例 #1
0
    //*************************************************************************
    //  Constructor: SelectionCoordinator()
    //
    /// <summary>
    /// Initializes a new instance of the <see cref="SelectionCoordinator" />
    /// class.
    /// </summary>
    ///
    /// <param name="thisWorkbook">
    /// The Excel workbook.
    /// </param>
    ///
    /// <param name="edgeWorksheet">
    /// The edge worksheet in the Excel workbook.
    /// </param>
    ///
    /// <param name="edgeTable">
    /// The edge table on the edge worksheet.
    /// </param>
    ///
    /// <param name="vertexWorksheet">
    /// The vertex worksheet in the Excel workbook.
    /// </param>
    ///
    /// <param name="vertexTable">
    /// The vertex table on the vertex worksheet.
    /// </param>
    ///
    /// <param name="groupWorksheet">
    /// The group worksheet in the Excel workbook.
    /// </param>
    ///
    /// <param name="groupTable">
    /// The group table on the group worksheet.
    /// </param>
    ///
    /// <param name="groupVertexWorksheet">
    /// The group-vertex worksheet in the Excel workbook.
    /// </param>
    ///
    /// <param name="taskPane">
    /// The TaskPane.
    /// </param>
    //*************************************************************************

    public SelectionCoordinator
    (
        ThisWorkbook thisWorkbook,
        Sheet1 edgeWorksheet,
        Microsoft.Office.Tools.Excel.ListObject edgeTable,
        Sheet2 vertexWorksheet,
        Microsoft.Office.Tools.Excel.ListObject vertexTable,
        Sheet5 groupWorksheet,
        Microsoft.Office.Tools.Excel.ListObject groupTable,
        Sheet6 groupVertexWorksheet,
        TaskPane taskPane
    )
    {
        Debug.Assert(thisWorkbook != null);
        Debug.Assert(edgeWorksheet != null);
        Debug.Assert(edgeTable != null);
        Debug.Assert(vertexWorksheet != null);
        Debug.Assert(vertexTable != null);
        Debug.Assert(groupWorksheet != null);
        Debug.Assert(groupTable != null);
        Debug.Assert(groupVertexWorksheet != null);
        Debug.Assert(taskPane != null);

        m_oThisWorkbook = thisWorkbook;
        m_oEdgeWorksheet = edgeWorksheet;
        m_oVertexWorksheet = vertexWorksheet;
        m_oGroupWorksheet = groupWorksheet;
        m_oGroupTable = groupTable;
        m_oGroupVertexWorksheet = groupVertexWorksheet;
        m_oTaskPane = taskPane;

        m_bIgnoreSelectionEvents = false;
        m_bUpdateVertexSelectionOnActivation = false;
        m_bUpdateEdgeSelectionOnActivation = false;
        m_bUpdateGroupSelectionOnActivation = false;


        edgeTable.SelectionChange += new DocEvents_SelectionChangeEventHandler(
            EdgeTable_SelectionChange);

        edgeTable.Deselected += new DocEvents_SelectionChangeEventHandler(
            EdgeTable_Deselected);

        m_oEdgeWorksheet.ActivateEvent += new DocEvents_ActivateEventHandler(
            EdgeWorksheet_ActivateEvent);


        vertexTable.SelectionChange +=
            new DocEvents_SelectionChangeEventHandler(
                VertexTable_SelectionChange);

        vertexTable.Deselected += new DocEvents_SelectionChangeEventHandler(
            VertexTable_Deselected);

        m_oVertexWorksheet.ActivateEvent += new DocEvents_ActivateEventHandler(
            VertexWorksheet_ActivateEvent);


        m_oGroupTable.SelectionChange +=
            new DocEvents_SelectionChangeEventHandler(
                GroupTable_SelectionChange);

        m_oGroupTable.Deselected += new DocEvents_SelectionChangeEventHandler(
            GroupTable_Deselected);

        m_oGroupWorksheet.ActivateEvent += new DocEvents_ActivateEventHandler(
            GroupWorksheet_ActivateEvent);


        m_oTaskPane.SelectionChangedInGraph +=
            new EventHandler<EventArgs>(this.TaskPane_SelectionChangedInGraph);
    }