当前位置: 首页>>代码示例>>C#>>正文


C# Microsoft.Office.Interop.Visio.DrawRectangle方法代码示例

本文整理汇总了C#中Microsoft.Office.Interop.Visio.DrawRectangle方法的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.Office.Interop.Visio.DrawRectangle方法的具体用法?C# Microsoft.Office.Interop.Visio.DrawRectangle怎么用?C# Microsoft.Office.Interop.Visio.DrawRectangle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Office.Interop.Visio的用法示例。


在下文中一共展示了Microsoft.Office.Interop.Visio.DrawRectangle方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Render

        public void Render(IVisio.Page page)
        {

            var dic = GetDayOfWeekDic();

            // calcualte actual days in month
            int weekday = 0 + dic[this.MonthYear.FirstDay.DayOfWeek];
            int week = 0;
          
            foreach (int day in Enumerable.Range(0,this.MonthYear.DaysInMonth))
            {
                double x = 0.0 + weekday*1.0;
                double y = 6.0 - week*1.0;
                var shape = page.DrawRectangle(x, y, x + 0.9, y + 0.9);

                weekday++;
                if (weekday >= 7)
                {
                    week++;
                    weekday = 0;
                }

                shape.Text = string.Format("{0}", new System.DateTime(this.MonthYear.Year, this.MonthYear.Month, day+1));
            }
        }
开发者ID:modulexcite,项目名称:Visio-Code-Samples,代码行数:25,代码来源:MonthGrid.cs

示例2: DrawNode

 public static void DrawNode(
     BoxL.Node node,
     VA.Drawing.Rectangle rect, IVisio.Page page)
 {           
     var shape = page.DrawRectangle(rect);
     node.Data = shape;
 }
开发者ID:shekharssorot2002,项目名称:VisioAutomation2.0,代码行数:7,代码来源:BoxLayoutShared.cs

示例3: CreateStandardShape

 public static IVisio.Shape CreateStandardShape(IVisio.Page page)
 {
     var shape = page.DrawRectangle(1, 1, 4, 3);
     var cell_width = shape.CellsU["Width"];
     var cell_height = shape.CellsU["Height"];
     cell_width.Formula = "=(1.0+2.5)";
     cell_height.Formula = "=(0.0+1.5)";
     return shape;
 }
开发者ID:modulexcite,项目名称:Visio-Code-Samples,代码行数:9,代码来源:Util.cs

示例4: DrawEntityRectangle

        /// <summary>
        /// Draw an "Entity" Rectangle
        /// </summary>
        /// <param name="page">The Page on which to draw</param>
        /// <param name="entityName">The name of the entity</param>
        /// <param name="ownership">The ownership type of the entity</param>
        /// <returns>The newly drawn rectangle</returns>
        private VisioApi.Shape DrawEntityRectangle(VisioApi.Page page, string entityName, OwnershipTypes ownership)
        {
            VisioApi.Shape rect = page.DrawRectangle(X_POS1, Y_POS1, X_POS2, Y_POS2);
            rect.Name = entityName;
            rect.Text = entityName + " ";

            // Determine the shape fill color based on entity ownership.
            string fillColor;

            // Update the style of the entity name
            VisioApi.Characters characters = rect.Characters;
            characters.Begin = 0;
            characters.End = entityName.Length;
            characters.set_CharProps((short)VisioApi.VisCellIndices.visCharacterStyle, (short)VisioApi.VisCellVals.visBold);
            characters.set_CharProps((short)VisioApi.VisCellIndices.visCharacterSize, NAME_CHARACTER_SIZE);
            //set the font family of the text to segoe for the visio 2013.
            if (VersionName == "15.0")
            characters.set_CharProps((short)VisioApi.VisCellIndices.visCharacterFont, (short)FONT_STYLE); 
          
            switch (ownership)
            {
                case OwnershipTypes.BusinessOwned:                   
                    fillColor = "RGB(255,140,0)"; // orange
                    characters.set_CharProps((short)VisioApi.VisCellIndices.visCharacterColor, (short)VisioApi.VisDefaultColors.visBlack);// set the font color of the text
                    break;
                case OwnershipTypes.OrganizationOwned:                    
                    fillColor = "RGB(127, 186, 0)"; // green
                    characters.set_CharProps((short)VisioApi.VisCellIndices.visCharacterColor, (short)VisioApi.VisDefaultColors.visBlack);// set the font color of the text
                    break;
                case OwnershipTypes.UserOwned:                    
                    fillColor = "RGB(0,24,143)"; // blue 
                    characters.set_CharProps((short)VisioApi.VisCellIndices.visCharacterColor, (short)VisioApi.VisDefaultColors.visWhite);// set the font color of the text
                    break;
                default:
                    fillColor = "RGB(255,255,255)"; // White
                    characters.set_CharProps((short)VisioApi.VisCellIndices.visCharacterColor, (short)VisioApi.VisDefaultColors.visDarkBlue);// set the font color of the text
                    break;
            }

            // Set the fill color, placement properties, and line weight of the shape.
            rect.get_CellsSRC(VISIO_SECTION_OJBECT_INDEX, (short)VisioApi.VisRowIndices.visRowMisc, (short)VisioApi.VisCellIndices.visLOFlags).FormulaU = ((int)VisioApi.VisCellVals.visLOFlagsPlacable).ToString();
            rect.get_CellsSRC(VISIO_SECTION_OJBECT_INDEX, (short)VisioApi.VisRowIndices.visRowFill, (short)VisioApi.VisCellIndices.visFillForegnd).FormulaU = fillColor;            
            return rect;
        }
开发者ID:cesugden,项目名称:Scripts,代码行数:51,代码来源:DiagramBuilder.cs

示例5: DrawEntityRectangle

        /// <summary>
        /// Draw an "Entity" Rectangle
        /// </summary>
        /// <param name="page">The Page on which to draw</param>
        /// <param name="entityName">The name of the entity</param>
        /// <param name="ownership">The ownership type of the entity</param>
        /// <returns>The newly drawn rectangle</returns>
        private VisioApi.Shape DrawEntityRectangle(VisioApi.Page page, string entityName, OwnershipTypes ownership)
        {
            VisioApi.Shape rect = page.DrawRectangle(X_POS1, Y_POS1, X_POS2, Y_POS2);
            rect.Name = entityName;
            rect.Text = entityName + " ";

            //// Determine the shape fill color based on entity ownership.
            //string fillColor;

            //switch (ownership)
            //{
            //    case OwnershipTypes.BusinessOwned:
            //        fillColor = "RGB(255,202,176)"; // Light orange
            //        break;
            //    case OwnershipTypes.OrganizationOwned:
            //        fillColor = "RGB(255,255,176)"; // Light yellow
            //        break;
            //    case OwnershipTypes.UserOwned:
            //        fillColor = "RGB(204,255,204)"; // Light green
            //        break;
            //    default:
            //        fillColor = "RGB(255,255,255)"; // White
            //        break;
            //}

            // Set the fill color, placement properties, and line weight of the shape.
            rect.get_CellsSRC(VISIO_SECTION_OJBECT_INDEX, (short)VisioApi.VisRowIndices.visRowMisc, (short)VisioApi.VisCellIndices.visLOFlags).Formula = ((int)VisioApi.VisCellVals.visLOFlagsPlacable).ToString();
            //rect.get_CellsSRC(VISIO_SECTION_OJBECT_INDEX, (short)VisioApi.VisRowIndices.visRowFill, (short)VisioApi.VisCellIndices.visFillForegnd).Formula = fillColor;
            // Update the style of the entity name
            VisioApi.Characters characters = rect.Characters;
            characters.Begin = 0;
            characters.End = entityName.Length;
            characters.set_CharProps((short)VisioApi.VisCellIndices.visCharacterStyle, (short)VisioApi.VisCellVals.visBold);
            characters.set_CharProps((short)VisioApi.VisCellIndices.visCharacterColor, (short)VisioApi.VisDefaultColors.visDarkBlue);
            characters.set_CharProps((short)VisioApi.VisCellIndices.visCharacterSize, NAME_CHARACTER_SIZE);

            return rect;
        }
开发者ID:imranakram,项目名称:CrmChainsaw,代码行数:45,代码来源:DiagramBuilder.cs

示例6: draw_standard_shapes

 private IVisio.Shape[] draw_standard_shapes(IVisio.Page page1)
 {
     var s1 = page1.DrawRectangle(0, 0, 1, 1);
     var s2 = page1.DrawRectangle(0, 3, 1, 4);
     var s3 = page1.DrawRectangle(3, 0, 4, 1);
     s1.Text = "A";
     s2.Text = "B";
     s3.Text = "C";
     return new[] { s1, s2, s3 };
 }
开发者ID:firestream99,项目名称:VisioAutomation,代码行数:10,代码来源:PathAnalysis_Tests.cs

示例7: Render

        public void Render(IVisio.Page page)
        {
            this.TotalMarginWidth = this.Rectangle.Width*(0.10);
            this.TotalBarSpacingWidth = this.Rectangle.Width * (0.10);
            this.TotalBarWidth = this.Rectangle.Width*(0.80);

            int num_points = this.DataPoints.Count;

            double bar_spacing = num_points > 1 ? this.TotalBarSpacingWidth/num_points : 0.0;
            double bar_width = num_points > 0 ? this.TotalBarWidth/num_points : this.TotalBarWidth;

            double cur_x = this.Rectangle.Left + (this.TotalMarginWidth/2.0);

            double max = this.DataPoints.Select(i => i.Value).Max();
            double min = this.DataPoints.Select(i => i.Value).Min();
            var range = ChartUtil.GetValueRangeDistance(min, max);

            double base_y = this.Rectangle.Bottom;

            if (min < 0.0)
            {
                base_y += System.Math.Abs(this.Rectangle.Height * (min / range));
            }

            var category_axis_start_point = new Drawing.Point(this.Rectangle.Left, base_y);
            var category_axis_end_point = new Drawing.Point(this.Rectangle.Right, base_y);
            var category_axis_shape = page.DrawLine(category_axis_start_point, category_axis_end_point);

            foreach (var p in this.DataPoints)
            {
                var value_height = System.Math.Abs(this.Rectangle.Height*(p.Value/range));

                Drawing.Point bar_p0;
                Drawing.Point bar_p1;

                if (p.Value >= 0.0)
                {
                    bar_p0 = new Drawing.Point(cur_x, base_y);
                    bar_p1 = new Drawing.Point(cur_x + bar_width, base_y + value_height);
                }
                else
                {
                    bar_p0 = new Drawing.Point(cur_x, base_y - value_height);
                    bar_p1 = new Drawing.Point(cur_x + bar_width, base_y);                    
                }
                
                var bar_rect = new Drawing.Rectangle(bar_p0, bar_p1);
                var shape = page.DrawRectangle(bar_rect);
                p.VisioShape = shape;

                if (p.Label != null)
                {
                    shape.Text = p.Label;
                }

                cur_x += bar_width + bar_spacing;
            }

            var allshapes = this.DataPoints.Select(dp => dp.VisioShape).Where(s => s != null).ToList();
            allshapes.Add(category_axis_shape);

            ChartUtil.GroupShapesIfNeeded(page, allshapes);

        }
开发者ID:shekharssorot2002,项目名称:VisioAutomation2.0,代码行数:64,代码来源:BarChart.cs

示例8: DrawRectangle

        private static Visio.Shape DrawRectangle(Visio.Page page, string name, int titleLength, string text, string fillColor)
        {
            Visio.Shape rect = page.DrawRectangle(X_POS1, Y_POS1, X_POS2, Y_POS2);
            rect.Name = name.ToUpperInvariant();
            rect.Text = text;

            // Set the fill color, placement properties, and line weight of the shape.
            rect.get_CellsU("ObjType").FormulaU = ((int)Visio.VisCellVals.visLOFlagsPlacable).ToString();
            rect.get_CellsU("FillForegnd").FormulaU = fillColor;
            rect.get_CellsU("Width").FormulaU = "TEXTWIDTH(TheText,100mm)";
            rect.get_CellsU("Height").FormulaU = "TEXTHEIGHT(TheText,100mm)";

            // Update the style of the entity name
            Visio.Characters characters = rect.Characters;
            characters.set_CharProps((short)Visio.VisCellIndices.visCharacterSize, NAME_CHARACTER_SIZE);
            characters.set_ParaProps((short)Visio.VisCellIndices.visHorzAlign, (short)Visio.VisCellVals.visHorzLeft);

            Visio.Characters titleChars = rect.Characters;
            titleChars.End = titleLength;
            titleChars.set_CharProps((short)Visio.VisCellIndices.visCharacterStyle, (short)Visio.VisCellVals.visBold);
            titleChars.set_CharProps((short)Visio.VisCellIndices.visCharacterColor, (short)Visio.VisDefaultColors.visDarkBlue);
            titleChars.set_ParaProps((short)Visio.VisCellIndices.visHorzAlign, (short)Visio.VisCellVals.visHorzCenter);

            return rect;
        }
开发者ID:thijskuipers,项目名称:ExperlogixVisioDiagram,代码行数:25,代码来源:Program.cs

示例9: DrawTableHeader

        /// <summary>
        /// This method is drawing header of core connections table
        /// </summary>
        /// <param name="aPage">page to drawn on</param>
        /// <param name="aStartPosY">position in vertical in which table header should start</param>
        /// <returns>vertical position after drawing</returns>
        private double DrawTableHeader( Visio.Page aPage, double aStartPosY )
        {
            double _currentX = mMargin;
            double _nextX = mMargin + mEquiWidth;

            Visio.Shape _newShape = aPage.DrawRectangle( _currentX, aStartPosY, _nextX, aStartPosY - mTableHeaderCellWidth );
            SetTextProperties( _newShape, "Equipment Name", FONT_SIZE, (int)Visio.VisCellVals.visHorzCenter );

            _currentX = _nextX;
            _nextX = _currentX + mElconnWidth;

            _newShape = aPage.DrawRectangle( _currentX, aStartPosY, _nextX, aStartPosY - mTableHeaderCellWidth );
            SetTextProperties( _newShape, "Conn", FONT_SIZE, (int)Visio.VisCellVals.visHorzCenter );

            _currentX = _nextX;
            _nextX = _currentX + mCoreWidth;

            _newShape = aPage.DrawRectangle( _currentX, aStartPosY, _nextX, aStartPosY - mTableHeaderCellWidth );
            SetTextProperties( _newShape, "Terminator", FONT_SIZE, (int)Visio.VisCellVals.visHorzCenter );

            _currentX = _nextX;
            _nextX = _currentX + mSpaceBetween;

            aPage.DrawRectangle( _currentX, aStartPosY, _nextX, aStartPosY - mTableHeaderCellWidth );

            _currentX = _nextX;
            _nextX = _currentX + mCoreWidth;

            _newShape = aPage.DrawRectangle( _currentX, aStartPosY, _nextX, aStartPosY - mTableHeaderCellWidth );
            SetTextProperties( _newShape, "Core", FONT_SIZE, (int)Visio.VisCellVals.visHorzCenter );

            _currentX = _nextX;
            _nextX = _currentX + mSpaceBetween;

            aPage.DrawRectangle( _currentX, aStartPosY, _nextX, aStartPosY - mTableHeaderCellWidth );

            _currentX = _nextX;
            _nextX = _currentX + mCableWidth;

            _newShape = aPage.DrawRectangle( _currentX, aStartPosY, _nextX, aStartPosY - mTableHeaderCellWidth / 2.0 );
            SetTextProperties( _newShape, "Cable Name", FONT_SIZE, (int)Visio.VisCellVals.visHorzCenter );

            _newShape = aPage.DrawRectangle( _currentX, aStartPosY - mTableHeaderCellWidth / 2.0, _nextX, aStartPosY - mTableHeaderCellWidth );
            SetTextProperties( _newShape, "Cable Component", FONT_SIZE, (int)Visio.VisCellVals.visHorzCenter );

            _currentX = _nextX;
            _nextX = _currentX + mSpaceBetween;

            aPage.DrawRectangle( _currentX, aStartPosY, _nextX, aStartPosY - mTableHeaderCellWidth );

            _currentX = _nextX;
            _nextX = _currentX + mCoreWidth;

            _newShape = aPage.DrawRectangle( _currentX, aStartPosY, _nextX, aStartPosY - mTableHeaderCellWidth );
            SetTextProperties( _newShape, "Core", FONT_SIZE, (int)Visio.VisCellVals.visHorzCenter );

            _currentX = _nextX;
            _nextX = _currentX + mSpaceBetween;

            aPage.DrawRectangle( _currentX, aStartPosY, _nextX, aStartPosY - mTableHeaderCellWidth );

            _currentX = _nextX;
            _nextX = _currentX + mCoreWidth;

            _newShape = aPage.DrawRectangle( _currentX, aStartPosY, _nextX, aStartPosY - mTableHeaderCellWidth );
            SetTextProperties( _newShape, "Terminator", FONT_SIZE, (int)Visio.VisCellVals.visHorzCenter );

            _currentX = _nextX;
            _nextX = _currentX + mElconnWidth;

            _newShape = aPage.DrawRectangle( _currentX, aStartPosY, _nextX, aStartPosY - mTableHeaderCellWidth );
            SetTextProperties( _newShape, "Conn", FONT_SIZE, (int)Visio.VisCellVals.visHorzCenter );

            _currentX = _nextX;
            _nextX = _currentX + mEquiWidth;

            _newShape = aPage.DrawRectangle( _currentX, aStartPosY, _nextX, aStartPosY - mTableHeaderCellWidth );
            SetTextProperties( _newShape, "Equipment Name", FONT_SIZE, (int)Visio.VisCellVals.visHorzCenter );

            return ( aStartPosY - mTableHeaderCellWidth );
        }
开发者ID:freudshow,项目名称:raffles-codes,代码行数:87,代码来源:CoreConnectionsDiagram.cs

示例10: DrawDiagramHeader

        /// <summary>
        /// This method is drawing core connections diagram header
        /// </summary>
        /// <param name="aPage">page on which header should be placed</param>
        /// <returns>vertical position after drawing</returns>
        private double DrawDiagramHeader( Visio.Page aPage )
        {
            Visio.Shape _newShape = aPage.DrawRectangle( mInitialPosX, mInitialPosY, mInitialPosX + mSingleWidth * 3, mInitialPosY - mSingleHeight );
            SetTextProperties( _newShape, "TITLE", FONT_SIZE, (int)Visio.VisCellVals.visHorzCenter );

            _newShape = aPage.DrawRectangle( mInitialPosX + mSingleWidth * 3, mInitialPosY, mInitialPosX + mSingleWidth * 4, mInitialPosY - mSingleHeight );
            SetTextProperties( _newShape, "DRWN BY/DATE", FONT_SIZE, (int)Visio.VisCellVals.visHorzLeft );

            _newShape = aPage.DrawRectangle( mInitialPosX + mSingleWidth * 4, mInitialPosY, mInitialPosX + mSingleWidth * 5, mInitialPosY - mSingleHeight );
            SetTextProperties( _newShape, string.Empty, FONT_SIZE, (int)Visio.VisCellVals.visHorzLeft );

            _newShape = aPage.DrawRectangle( mInitialPosX + mSingleWidth * 5, mInitialPosY, mInitialPosX + mSingleWidth * 7 + mMargin, mInitialPosY - mSingleHeight );
            SetTextProperties( _newShape, "SHEET OF", FONT_SIZE, (int)Visio.VisCellVals.visHorzLeft );

            _newShape = aPage.DrawRectangle( mInitialPosX, mInitialPosY - mSingleHeight, mInitialPosX + mSingleWidth * 3, mInitialPosY - mSingleHeight * 3 );
            SetTextProperties( _newShape, string.Empty, FONT_SIZE, (int)Visio.VisCellVals.visHorzCenter );

            _newShape = aPage.DrawRectangle( mInitialPosX + mSingleWidth * 3, mInitialPosY - mSingleHeight, mInitialPosX + mSingleWidth * 4, mInitialPosY - mSingleHeight * 2 );
            SetTextProperties( _newShape, "CHKD BY/DATE", FONT_SIZE, (int)Visio.VisCellVals.visHorzLeft );

            _newShape = aPage.DrawRectangle( mInitialPosX + mSingleWidth * 4, mInitialPosY - mSingleHeight, mInitialPosX + mSingleWidth * 5, mInitialPosY - mSingleHeight * 2 );
            SetTextProperties( _newShape, string.Empty, FONT_SIZE, (int)Visio.VisCellVals.visHorzLeft );

            _newShape = aPage.DrawRectangle( mInitialPosX + mSingleWidth * 5, mInitialPosY - mSingleHeight, mInitialPosX + mSingleWidth * 7 + mMargin, mInitialPosY - mSingleHeight * 2 );
            SetTextProperties( _newShape, "SHIP NO:", FONT_SIZE, (int)Visio.VisCellVals.visHorzLeft );

            _newShape = aPage.DrawRectangle( mInitialPosX + mSingleWidth * 3, mInitialPosY - mSingleHeight * 2, mInitialPosX + mSingleWidth * 4, mInitialPosY - mSingleHeight * 3 );
            SetTextProperties( _newShape, "APPR BY/DATE", FONT_SIZE, (int)Visio.VisCellVals.visHorzLeft );

            _newShape = aPage.DrawRectangle( mInitialPosX + mSingleWidth * 4, mInitialPosY - mSingleHeight * 2, mInitialPosX + mSingleWidth * 5, mInitialPosY - mSingleHeight * 3 );
            SetTextProperties( _newShape, string.Empty, FONT_SIZE, (int)Visio.VisCellVals.visHorzLeft );

            _newShape = aPage.DrawRectangle( mInitialPosX + mSingleWidth * 5, mInitialPosY - mSingleHeight * 2, mInitialPosX + mSingleWidth * 6 + mMargin / 2.0, mInitialPosY - mSingleHeight * 3 );
            SetTextProperties( _newShape, "DRG NO:", FONT_SIZE, (int)Visio.VisCellVals.visHorzLeft );

            _newShape = aPage.DrawRectangle( mInitialPosX + mSingleWidth * 6 + mMargin / 2.0, mInitialPosY - mSingleHeight * 2, mInitialPosX + mSingleWidth * 7 + mMargin, mInitialPosY - mSingleHeight * 3 );
            SetTextProperties( _newShape, "REV NO:", FONT_SIZE, (int)Visio.VisCellVals.visHorzLeft );

            return ( mInitialPosY - mSingleHeight * 3 );
        }
开发者ID:freudshow,项目名称:raffles-codes,代码行数:45,代码来源:CoreConnectionsDiagram.cs

示例11: DrawCable

        /// <summary>
        /// This method is drawing schema for single cable
        /// </summary>
        /// <param name="aPage">page to draw on</param>
        /// <param name="aCableInfo">information about cable to draw</param>
        /// <param name="aPosY">vertical position in which schema should start</param>
        /// <returns>ertical position after drawing</returns>
        private double DrawCable( Visio.Page aPage, CableInfo aCableInfo, double aPosY )
        {
            if( aCableInfo.CoreNo == 0 )
                aCableInfo.CoreInfo.Add( new CoreInfo( Database.DbElement.GetElement(), aCableInfo ) );

            double _cableHeight = aCableInfo.CoreNo * mCoreHeight;

            Visio.Shape _newShape = aPage.DrawLine( mCablePosX, aPosY - _cableHeight / 2.0, mCablePosX + mCableWidth, aPosY - _cableHeight / 2.0 );
            SetTextProperties( _newShape, aCableInfo.CableName + Environment.NewLine + aCableInfo.ComponentName, FONT_SIZE, (int)Visio.VisCellVals.visHorzCenter );

            _newShape = aPage.DrawLine( mCablePosX, aPosY, mCablePosX, aPosY - _cableHeight );
            _newShape = aPage.DrawLine( mCablePosX + mCableWidth, aPosY, mCablePosX + mCableWidth, aPosY - _cableHeight );

            int _lastBeginEqui = 0, _lastEndEqui = 0, _lastBeginElconn = 0, _lastEndElconn = 0, _current = 0;
            string _lastBeginEquiName = string.Empty, _lastEndEquiName = string.Empty, _lastBeginElconnName = string.Empty, _lastEndElconnName = string.Empty;

            foreach( CoreInfo _core in aCableInfo.CoreInfo )
            {
                //draw core boxes
                _newShape = aPage.DrawRectangle( mCablePosX - mCoreWidth - mSpaceBetween, aPosY - _current * mCoreHeight, mCablePosX - mSpaceBetween, aPosY - ( _current + 1 ) * mCoreHeight );
                SetTextProperties( _newShape, _core.CoreName, "6pt", (int)Visio.VisCellVals.visHorzCenter );
                _newShape = aPage.DrawRectangle( mCablePosX + mCableWidth + mSpaceBetween, aPosY - _current * mCoreHeight, mCablePosX + mCableWidth + mSpaceBetween + mCoreWidth, aPosY - ( _current + 1 ) * mCoreHeight );
                SetTextProperties( _newShape, _core.CoreName, "6pt", (int)Visio.VisCellVals.visHorzCenter );

                //draw pin boxes
                _newShape = aPage.DrawRectangle( mCablePosX - ( mCoreWidth + mSpaceBetween ) * 2, aPosY - _current * mCoreHeight, mCablePosX - mCoreWidth - mSpaceBetween * 2, aPosY - ( _current + 1 ) * mCoreHeight );
                SetTextProperties( _newShape, _core.StartPin, "6pt", (int)Visio.VisCellVals.visHorzCenter );
                _newShape = aPage.DrawRectangle( mCablePosX + mCableWidth + mSpaceBetween * 2 + mCoreWidth, aPosY - _current * mCoreHeight, mCablePosX + mCableWidth + ( mSpaceBetween + mCoreWidth ) * 2, aPosY - ( _current + 1 ) * mCoreHeight );
                SetTextProperties( _newShape, _core.EndPin, "6pt", (int)Visio.VisCellVals.visHorzCenter );

                //check/draw elconns
                if( _core.StartElconn == string.Empty || _lastBeginElconnName != _core.StartElconn )
                {
                    if( _current > 0 )
                    {
                        double _posX = mCablePosX - ( mSpaceBetween + mCoreWidth ) * 2;
                        double _posY = aPosY - _lastBeginElconn * mCoreHeight;
                        //draw elconn
                        _newShape = aPage.DrawRectangle( _posX - mElconnWidth, _posY, _posX, _posY - ( _current - _lastBeginElconn ) * mCoreHeight );
                        SetTextProperties( _newShape, _lastBeginElconnName, "6pt", (int)Visio.VisCellVals.visHorzCenter );
                        _lastBeginElconn = _current;
                    }
                    _lastBeginElconnName = _core.StartElconn;
                }
                if( _core.EndElconn == string.Empty || _lastEndElconnName != _core.EndElconn )
                {
                    if( _current > 0 )
                    {
                        //draw elconn
                        double _posX = mCablePosX + ( mSpaceBetween + mCoreWidth ) * 2 + mCableWidth;
                        double _posY = aPosY - _lastEndElconn * mCoreHeight;
                        //draw elconn
                        _newShape = aPage.DrawRectangle( _posX, _posY, _posX + mElconnWidth, _posY - ( _current - _lastEndElconn ) * mCoreHeight );
                        SetTextProperties( _newShape, _lastEndElconnName, "6pt", (int)Visio.VisCellVals.visHorzCenter );
                        _lastEndElconn = _current;
                    }
                    _lastEndElconnName = _core.EndElconn;
                }

                //check/draw equips
                if( _core.StartEqui == string.Empty || _lastBeginEquiName != _core.StartEqui )
                {
                    if( _current > 0 )
                    {
                        //draw equi
                        double _posX = mCablePosX - ( mSpaceBetween + mCoreWidth ) * 2 - mElconnWidth;
                        double _posY = aPosY - _lastBeginEqui * mCoreHeight;

                        _newShape = aPage.DrawRectangle( _posX - mEquiWidth, _posY, _posX, _posY - ( _current - _lastBeginEqui ) * mCoreHeight );
                        SetTextProperties( _newShape, _lastBeginEquiName, "6pt", (int)Visio.VisCellVals.visHorzCenter );
                        _lastBeginEqui = _current;
                    }
                    _lastBeginEquiName = _core.StartEqui;
                }
                if( _core.EndEqui == string.Empty || _lastEndEquiName != _core.EndEqui )
                {
                    if( _current > 0 )
                    {
                        //draw equi
                        double _posX = mCablePosX + ( mSpaceBetween + mCoreWidth ) * 2 + mCableWidth + mElconnWidth;
                        double _posY = aPosY - _lastEndEqui * mCoreHeight;

                        _newShape = aPage.DrawRectangle( _posX, _posY, _posX + mEquiWidth, _posY - ( _current - _lastEndEqui ) * mCoreHeight );
                        SetTextProperties( _newShape, _lastEndEquiName, "6pt", (int)Visio.VisCellVals.visHorzCenter );
                        _lastEndEqui = _current;
                    }
                    _lastEndEquiName = _core.EndEqui;
                }
                _current++;
            }
            //draw last elconns
            double _pX = mCablePosX - ( mSpaceBetween + mCoreWidth ) * 2;
            double _pY = aPosY - _lastBeginElconn * mCoreHeight;
//.........这里部分代码省略.........
开发者ID:freudshow,项目名称:raffles-codes,代码行数:101,代码来源:CoreConnectionsDiagram.cs


注:本文中的Microsoft.Office.Interop.Visio.DrawRectangle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。