Exemple #1
0
        //*************************************************************************
        //  Method: ThisWorkbook_SetVisualAttribute2()
        //
        /// <summary>
        /// Handles the SetVisualAttribute2 event on ThisWorkbook.
        /// </summary>
        ///
        /// <param name="sender">
        /// Standard event argument.
        /// </param>
        ///
        /// <param name="e">
        /// Standard event argument.
        /// </param>
        //*************************************************************************
        private void ThisWorkbook_SetVisualAttribute2(
            Object sender,
            SetVisualAttributeEventArgs e
            )
        {
            Debug.Assert(e != null);
            AssertValid();

            Microsoft.Office.Interop.Excel.Range oSelectedRange;

            if ( e.VisualAttributeSet ||
            !m_oSheets1And2Helper.TryGetSelectedRange(out oSelectedRange) )
            {
            return;
            }

            // See if the specified attribute is set by the helper class.

            m_oSheets1And2Helper.SetVisualAttribute(e, oSelectedRange,
            VertexTableColumnNames.Color, CommonTableColumnNames.Alpha);

            if (e.VisualAttributeSet)
            {
            return;
            }

            if (e.VisualAttribute == VisualAttributes.VertexShape)
            {
            Debug.Assert(e.AttributeValue is VertexShape);

            ExcelUtil.SetVisibleSelectedTableColumnData(
                this.Vertices.InnerObject, oSelectedRange,
                VertexTableColumnNames.Shape,

                ( new VertexShapeConverter() ).GraphToWorkbook(
                    (VertexShape)e.AttributeValue)
                );

            e.VisualAttributeSet = true;
            }
            else if (e.VisualAttribute == VisualAttributes.VertexRadius)
            {
            VertexRadiusDialog oVertexRadiusDialog = new VertexRadiusDialog();

            if (oVertexRadiusDialog.ShowDialog() == DialogResult.OK)
            {
                ExcelUtil.SetVisibleSelectedTableColumnData(
                    this.Vertices.InnerObject, oSelectedRange,
                    VertexTableColumnNames.Radius,
                    oVertexRadiusDialog.VertexRadius);

                e.VisualAttributeSet = true;
            }
            }
            else if (e.VisualAttribute == VisualAttributes.VertexVisibility)
            {
            Debug.Assert(e.AttributeValue is VertexWorksheetReader.Visibility);

            ExcelUtil.SetVisibleSelectedTableColumnData(
                this.Vertices.InnerObject, oSelectedRange,
                CommonTableColumnNames.Visibility,

                ( new VertexVisibilityConverter() ).GraphToWorkbook(
                    (VertexWorksheetReader.Visibility)e.AttributeValue)
                );

            e.VisualAttributeSet = true;
            }
        }
Exemple #2
0
        ThisWorkbook_SetVisualAttribute2
        (
            Object sender,
            SetVisualAttributeEventArgs e
        )
        {
            Debug.Assert(e != null);
            AssertValid();

            Microsoft.Office.Interop.Excel.Range oSelectedRange;

            if (e.VisualAttributeSet ||
                !m_oSheets1And2Helper.TryGetSelectedRange(out oSelectedRange))
            {
                return;
            }

            // See if the specified attribute is set by the helper class.

            m_oSheets1And2Helper.SetVisualAttribute(e, oSelectedRange,
                                                    VertexTableColumnNames.Color, CommonTableColumnNames.Alpha);

            if (e.VisualAttributeSet)
            {
                return;
            }

            if (e.VisualAttribute == VisualAttributes.VertexShape)
            {
                Debug.Assert(e.AttributeValue is VertexShape);

                ExcelUtil.SetVisibleSelectedTableColumnData(
                    this.Vertices.InnerObject, oSelectedRange,
                    VertexTableColumnNames.Shape,

                    (new VertexShapeConverter()).GraphToWorkbook(
                        (VertexShape)e.AttributeValue)
                    );

                e.VisualAttributeSet = true;
            }
            else if (e.VisualAttribute == VisualAttributes.VertexRadius)
            {
                VertexRadiusDialog oVertexRadiusDialog = new VertexRadiusDialog();

                if (oVertexRadiusDialog.ShowDialog() == DialogResult.OK)
                {
                    ExcelUtil.SetVisibleSelectedTableColumnData(
                        this.Vertices.InnerObject, oSelectedRange,
                        VertexTableColumnNames.Radius,
                        oVertexRadiusDialog.VertexRadius);

                    e.VisualAttributeSet = true;
                }
            }
            else if (e.VisualAttribute == VisualAttributes.VertexVisibility)
            {
                Debug.Assert(e.AttributeValue is VertexWorksheetReader.Visibility);

                ExcelUtil.SetVisibleSelectedTableColumnData(
                    this.Vertices.InnerObject, oSelectedRange,
                    CommonTableColumnNames.Visibility,

                    (new VertexVisibilityConverter()).GraphToWorkbook(
                        (VertexWorksheetReader.Visibility)e.AttributeValue)
                    );

                e.VisualAttributeSet = true;
            }
        }