本文整理汇总了C#中Microsoft.Office.Interop.Visio.DropManyU方法的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.Office.Interop.Visio.DropManyU方法的具体用法?C# Microsoft.Office.Interop.Visio.DropManyU怎么用?C# Microsoft.Office.Interop.Visio.DropManyU使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Office.Interop.Visio
的用法示例。
在下文中一共展示了Microsoft.Office.Interop.Visio.DropManyU方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DropManyU
public static short[] DropManyU(
IVisio.Page page,
IList<IVisio.Master> masters,
IEnumerable<VA.Drawing.Point> points)
{
if (masters == null)
{
throw new System.ArgumentNullException("masters");
}
if (masters.Count < 1)
{
return new short[0];
}
if (points == null)
{
throw new System.ArgumentNullException("points");
}
// NOTE: DropMany will fail if you pass in zero items to drop
var masters_obj_array = masters.Cast<object>().ToArray();
var xy_array = VA.Drawing.Point.ToDoubles(points).ToArray();
System.Array outids_sa;
page.DropManyU(masters_obj_array, xy_array, out outids_sa);
short[] outids = (short[])outids_sa;
return outids;
}
示例2: DropManyAutoConnectors
public static short[] DropManyAutoConnectors(
IVisio.Page page,
IEnumerable<VA.Drawing.Point> points)
{
if (points == null)
{
throw new System.ArgumentNullException("points");
}
// NOTE: DropMany will fail if you pass in zero items to drop
var app = page.Application;
var thing = app.ConnectorToolDataObject;
int num_points = points.Count();
var masters_obj_array = Enumerable.Repeat((object)thing, num_points).ToArray();
var xy_array = VA.Drawing.Point.ToDoubles(points).ToArray();
System.Array outids_sa;
page.DropManyU(masters_obj_array, xy_array, out outids_sa);
short[] outids = (short[])outids_sa;
return outids;
}
示例3: ConnectShapes
public static IList<IVisio.Shape> ConnectShapes(IVisio.Page page, IList<IVisio.Shape> fromshapes, IList<IVisio.Shape> toshapes, IVisio.Master connector_master, bool force_manual)
{
if (connector_master == null && force_manual )
{
throw new System.ArgumentNullException("if the connector object is null then force manual must be false");
}
// no_connector + force_manual -> INVALID
// no_connector + not_force_manual -> AutoConect
// yes_connector + force_manual -> Manual Connection
// object false + not_force_manual-> Autoconnect
if (fromshapes == null)
{
throw new System.ArgumentNullException(nameof(fromshapes));
}
if (toshapes == null)
{
throw new System.ArgumentNullException(nameof(toshapes));
}
if (fromshapes.Count != toshapes.Count)
{
throw new System.ArgumentException("must have same number of from and to shapes");
}
if (fromshapes.Count == 0)
{
return new List<IVisio.Shape>(0);
}
int num_connectors = fromshapes.Count;
var connectors = new List<IVisio.Shape>(num_connectors);
var points = Enumerable.Range(0, num_connectors).Select(i => new Drawing.Point(i*2.0, -2)).ToList();
IList<IVisio.Shape> con_shapes = null;
if (connector_master != null)
{
var masters = Enumerable.Repeat(connector_master, num_connectors).ToList();
short[] con_shapeids = page.DropManyU(masters, points);
con_shapes = page.Shapes.GetShapesFromIDs(con_shapeids);
}
else
{
short[] con_shapeids = Pages.PageHelper.DropManyAutoConnectors(page, points);
con_shapes = page.Shapes.GetShapesFromIDs(con_shapeids);
}
for (int i = 0; i < num_connectors; i++)
{
var from_shape = fromshapes[i];
var to_shape = toshapes[i];
var connector = con_shapes[i];
// Connect from Shape 1 to Shape2
ConnectorHelper.ConnectShapes(from_shape, to_shape, connector, true);
connectors.Add(connector);
}
return connectors;
}