本文整理汇总了C#中Page.DrawRectangle方法的典型用法代码示例。如果您正苦于以下问题:C# Page.DrawRectangle方法的具体用法?C# Page.DrawRectangle怎么用?C# Page.DrawRectangle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Page
的用法示例。
在下文中一共展示了Page.DrawRectangle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawRectangle
/// <summary>
/// Draw Rectangle with 2 connections points.
/// </summary>
public static Shape DrawRectangle(Page page, double x1, double y1, double x2, double y2)
{
Shape rect = page.DrawRectangle(x1, y1, x2, y2);
// add connection point1
short rowIndex1 = rect.AddRow(
(short)Microsoft.Office.Interop.Visio.VisSectionIndices.visSectionConnectionPts,
(short)Microsoft.Office.Interop.Visio.VisRowIndices.visRowLast,
(short)Microsoft.Office.Interop.Visio.VisRowTags.visTagCnnctPt);
Row row1 = rect.Section[(short)Microsoft.Office.Interop.Visio.VisSectionIndices.visSectionConnectionPts][rowIndex1];
row1.CellU[(short)Microsoft.Office.Interop.Visio.VisCellIndices.visCnnctX].FormulaU = "Width*0";
row1.CellU[(short)Microsoft.Office.Interop.Visio.VisCellIndices.visCnnctY].FormulaU = "Height*0.5";
row1.CellU[(short)Microsoft.Office.Interop.Visio.VisCellIndices.visCnnctDirX].FormulaU = "1";
row1.CellU[(short)Microsoft.Office.Interop.Visio.VisCellIndices.visCnnctDirY].FormulaU = "0";
row1.CellU[(short)Microsoft.Office.Interop.Visio.VisCellIndices.visCnnctType].FormulaU =
((short)Microsoft.Office.Interop.Visio.tagVisCellVals.visCnnctTypeInward).ToString(CultureInfo.InvariantCulture);
// add connection point2
short rowIndex2 = rect.AddRow(
(short)Microsoft.Office.Interop.Visio.VisSectionIndices.visSectionConnectionPts,
(short)Microsoft.Office.Interop.Visio.VisRowIndices.visRowLast,
(short)Microsoft.Office.Interop.Visio.VisRowTags.visTagCnnctPt);
Row row2 = rect.Section[(short)Microsoft.Office.Interop.Visio.VisSectionIndices.visSectionConnectionPts][rowIndex2];
row2.CellU[(short)Microsoft.Office.Interop.Visio.VisCellIndices.visCnnctX].FormulaU = "Width*1";
row2.CellU[(short)Microsoft.Office.Interop.Visio.VisCellIndices.visCnnctY].FormulaU = "Height*0.5";
row2.CellU[(short)Microsoft.Office.Interop.Visio.VisCellIndices.visCnnctDirX].FormulaU = "-1";
row2.CellU[(short)Microsoft.Office.Interop.Visio.VisCellIndices.visCnnctDirY].FormulaU = "0";
row2.CellU[(short)Microsoft.Office.Interop.Visio.VisCellIndices.visCnnctType].FormulaU =
((short)Microsoft.Office.Interop.Visio.tagVisCellVals.visCnnctTypeInward).ToString(CultureInfo.InvariantCulture);
return rect;
}
示例2: CreateStandardShape
public static Shape CreateStandardShape(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;
}