本文整理汇总了C#中VisioAutomation类的典型用法代码示例。如果您正苦于以下问题:C# VisioAutomation类的具体用法?C# VisioAutomation怎么用?C# VisioAutomation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VisioAutomation类属于命名空间,在下文中一共展示了VisioAutomation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PieSlice
public PieSlice(VA.Drawing.Point p0, double r, double start, double end)
{
this.Center = p0;
this.Radius = r;
this.Start = start;
this.End = end;
}
示例2: Snap
public VA.Drawing.Size Snap(VA.Drawing.Size size)
{
double x;
double y;
this.SnapXY(size.Width,size.Height,out x, out y);
return new VA.Drawing.Size(x, y);
}
示例3: AddElementEx
public static VA.Text.Markup.TextElement AddElementEx(this VA.Text.Markup.TextElement p, string text,
int? font, double? size, int? color,
VA.Drawing.AlignmentHorizontal? halign,
VA.Text.CharStyle? cs)
{
var el = p.AddElement(text);
if (font != null)
{
el.CharacterCells.Font = font.Value;
}
if (size.HasValue)
{
el.CharacterCells.Size = string.Format("{0}pt",size.Value);
}
if (color.HasValue)
{
var c = new VA.Drawing.ColorRGB(color.Value);
el.CharacterCells.Color = c.ToFormula();
}
if (halign.HasValue)
{
el.ParagraphCells.HorizontalAlign = (int) halign.Value;
}
if (cs.HasValue)
{
el.CharacterCells.Style = (int) cs;
}
return el;
}
示例4: GetPointAtRadius
public static VA.Drawing.Point GetPointAtRadius(VA.Drawing.Point origin, double angle, double radius)
{
var new_point = new VA.Drawing.Point(radius*System.Math.Cos(angle),
radius*System.Math.Sin(angle));
new_point = origin + new_point;
return new_point;
}
示例5: FromEllipse
public static BezierCurve FromEllipse(VA.Drawing.Point center, VA.Drawing.Size radius)
{
var pt1 = new VA.Drawing.Point(0, radius.Height); // top
var pt2 = new VA.Drawing.Point(radius.Width, 0); // right
var pt3 = new VA.Drawing.Point(0, -radius.Height); // bottom
var pt4 = new VA.Drawing.Point(-radius.Width, 0); // left
double dx = radius.Width * 4.0 * (System.Math.Sqrt(2) - 1) / 3;
double dy = radius.Height * 4.0 * (System.Math.Sqrt(2) - 1) / 3;
var curve_ControlPoints = new []
{
pt1,
pt1.Add(dx, 0),
pt2.Add(0, dy),
pt2,
pt2.Add(0, -dy),
pt3.Add(dx, 0),
pt3,
pt3.Add(-dx, 0),
pt4.Add(0, -dy),
pt4,
pt4.Add(0, dy),
pt1.Add(-dx, 0),
pt1
}
.Select(p => p + center).ToArray();
var curve_Degree = 3;
var curve = new BezierCurve(curve_ControlPoints, curve_Degree);
return curve;
}
示例6: SetViewRect
public static void SetViewRect(
this IVisio.Window window,
VA.Drawing.Rectangle rect)
{
// MSDN: http://msdn.microsoft.com/en-us/library/office/ms367542(v=office.14).aspx
window.SetViewRect(rect.Left, rect.Top, rect.Width, rect.Height);
}
示例7: DrawNode
public static void DrawNode(
BoxL.Node node,
VA.Drawing.Rectangle rect, IVisio.Page page)
{
var shape = page.DrawRectangle(rect);
node.Data = shape;
}
示例8: TestResize
private static void TestResize(IVisio.Document doc,
VA.Drawing.Size bottomleft_margin,
VA.Drawing.Size upperright_margin,
VA.Drawing.Size shape_size,
VA.Drawing.Size padding_size,
double expected_pinx,
double expected_piny)
{
var page = doc.Pages.Add();
var pagecells = new VA.Pages.PageCells();
pagecells.PageTopMargin = upperright_margin.Height;
pagecells.PageBottomMargin = bottomleft_margin.Height;
pagecells.PageLeftMargin = bottomleft_margin.Width;
pagecells.PageRightMargin = upperright_margin.Width;
var pageupdate = new VA.ShapeSheet.Update();
pageupdate.SetFormulas(pagecells);
pageupdate.Execute(page.PageSheet);
var shape = page.DrawRectangle(5, 5, 5 + shape_size.Width, 5+shape_size.Height);
page.ResizeToFitContents(padding_size);
var xform = VA.Shapes.XFormCells.GetCells(shape);
AssertVA.AreEqual(expected_pinx, expected_piny, xform.Pin(), 0.1);
page.Delete(0);
}
示例9: Apply
public void Apply(VA.ShapeSheet.Update update, short shapeid_label, short shapeid_box)
{
update.SetFormulas(shapeid_label, this.CharacterCells, 0);
update.SetFormulas(shapeid_label, this.ParagraphCells, 0);
update.SetFormulas(shapeid_box, this.FormatCells);
update.SetFormulas(shapeid_label, this.TextCells);
}
示例10: AddConnection
public Connector AddConnection(string id, Shape from, Shape to, string label,
VA.Shapes.Connections.ConnectorType type, int beginArrow, int endArrow, string hyperlink)
{
var new_connector = new Connector(from, to);
new_connector.ID = id;
new_connector.Label = label;
new_connector.ConnectorType = type;
new_connector.Cells = new VA.DOM.ShapeCells();
new_connector.Cells.BeginArrow = beginArrow;
new_connector.Cells.BeginArrowSize = beginArrow;
new_connector.Cells.EndArrow = endArrow;
new_connector.Cells.EndArrowSize = endArrow;
if (!string.IsNullOrEmpty(hyperlink))
{
//new_connector.VisioShape = IVisio.Shape; // IVisio.Shape();
var h = new_connector.VisioShape.Hyperlinks.Add();
h.Name = hyperlink; // Name of Hyperlink
h.Address = hyperlink; // Address of Hyperlink
}
this.Connectors.Add(id, new_connector);
return new_connector;
}
示例11: LoadFromXML
public static IList<DGMODEL.Drawing> LoadFromXML(VA.Scripting.Client client, SXL.XDocument xmldoc)
{
var pagedatas = LoadPageDataFromXML(client, xmldoc);
// STOP IF ANY ERRORS
int num_errors = pagedatas.Select(pagedata => pagedata.Errors.Count).Sum();
if (num_errors > 1)
{
foreach (var pagedata in pagedatas)
{
foreach (var error in pagedata.Errors)
{
client.WriteVerbose( error.Text);
}
client.WriteVerbose( "Errors encountered in shape data. Stopping.");
}
}
// DRAW EACH PAGE
foreach (var pagedata in pagedatas)
{
client.WriteVerbose( "Creating shape AutoLayout nodes");
foreach (var shape_info in pagedata.ShapeInfos)
{
var dg_shape = pagedata.DirectedGraph.AddShape(shape_info.ID, shape_info.Label, shape_info.Stencil, shape_info.Master);
dg_shape.URL = shape_info.URL;
dg_shape.CustomProperties = new Dictionary<string, VACUSTPROP.CustomPropertyCells>();
foreach (var kv in shape_info.custprops)
{
dg_shape.CustomProperties[kv.Key] = kv.Value;
}
}
client.WriteVerbose( "Creating connector AutoLayout nodes");
foreach (var con_info in pagedata.ConnectorInfos)
{
var def_connector_type = VACXN.ConnectorType.Curved;
var connectory_type = def_connector_type;
var from_shape = pagedata.DirectedGraph.Shapes.Find(con_info.From);
var to_shape = pagedata.DirectedGraph.Shapes.Find(con_info.To);
var def_con_color = new VA.Drawing.ColorRGB(0x000000);
var def_con_weight = 1.0/72.0;
var def_end_arrow = 2;
var dg_connector = pagedata.DirectedGraph.Connect(con_info.ID, from_shape, to_shape, con_info.Label, connectory_type);
dg_connector.Cells = new VA.DOM.ShapeCells();
dg_connector.Cells.LineColor = con_info.Element.AttributeAsColor("color", def_con_color).ToFormula();
dg_connector.Cells.LineWeight = con_info.Element.AttributeAsInches("weight", def_con_weight);
dg_connector.Cells.EndArrow = def_end_arrow;
}
client.WriteVerbose( "Rendering AutoLayout...");
}
client.WriteVerbose( "Finished rendering AutoLayout");
var directedgraphs = pagedatas.Select(pagedata => pagedata.DirectedGraph).ToList();
return directedgraphs;
}
示例12: PieChart
public PieChart(VA.Drawing.Rectangle rect)
{
var center = rect.Center;
var radius = System.Math.Min(rect.Width,rect.Height)/2.0;
this.DataPoints = new DataPointList();
this.Center = center;
this.Radius = radius;
}
示例13: BezierSegment
public BezierSegment(VA.Drawing.Point start, VA.Drawing.Point handle1, VA.Drawing.Point handle2, VA.Drawing.Point end)
: this()
{
this.Start = start;
this.Handle1 = handle1;
this.Handle2 = handle2;
this.End = end;
}
示例14: ApplyFormus
public void ApplyFormus(VA.ShapeSheet.Update update)
{
short titleshape_id = this.VisioShape.ID16;
update.SetFormulas(titleshape_id, this.Textcells);
update.SetFormulas(titleshape_id, this.ParagraphCells, 0);
update.SetFormulas(titleshape_id, this.CharacterCells, 0);
update.SetFormulas(titleshape_id, this.FormatCells);
}
示例15: Arc
public Arc(VA.Drawing.Point p0, double ri, double ro, double start, double end)
{
this.Center = p0;
this.InnerRadius = ri;
this.OuterRadius = ro;
this.StartAngle = start;
this.EndAngle = end;
}