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


C# Interop.Visio类代码示例

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


Microsoft.Office.Interop.Visio类属于命名空间,在下文中一共展示了Microsoft.Office.Interop.Visio类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
        }
开发者ID:firestream99,项目名称:VisioAutomation,代码行数:31,代码来源:PageHelper.cs

示例2: SRC

 public SRC(
     IVisio.VisSectionIndices section,
     IVisio.VisRowIndices row,
     IVisio.VisCellIndices cell)
     : this((short)section,(short)row,(short)cell)
 {
 }
开发者ID:firestream99,项目名称:VisioAutomation,代码行数:7,代码来源:SRC.cs

示例3: Render

        public IVisio.Document Render(IVisio.Application app)
        {
            var docs = app.Documents;
            var doc = docs.Add("");

            var ctx = new FormRenderingContext(app);
            ctx.Application = app;
            ctx.Document = doc;
            ctx.Pages = doc.Pages;
            ctx.Fonts = doc.Fonts;

            this.VisioDocument = doc;

            doc.Subject = this.Subject;
            doc.Title = this.Title;
            doc.Creator = this.Creator;
            doc.Company = this.Company;

            var pages = doc.Pages;
            foreach (var formpage in this.Pages)
            {
                var page = formpage.Draw(ctx);
            }

            if (pages.Count > 0)
            {
                // Delete the empty first page
                var first_page = VisioDocument.Pages[1];
                first_page.Delete(1);
                first_page = pages[1];
                var active_window = app.ActiveWindow;
                active_window.Page = first_page;
            }
            return doc;
        }
开发者ID:firestream99,项目名称:VisioAutomation,代码行数:35,代码来源:FormDocument.cs

示例4: Get

        /// <summary>
        /// Gets all the user properties defined on a shape
        /// </summary>
        /// <remarks>
        /// If there are no user properties then null will be returned</remarks>
        /// <param name="shape"></param>
        /// <returns>A list of user  properties</returns>
        public static IList<UserDefinedCell> Get(IVisio.Shape shape)
        {
            if (shape == null)
            {
                throw new System.ArgumentNullException("shape");
            }

            var prop_count = GetCount(shape);
            if (prop_count < 1)
            {
                return new List<UserDefinedCell>(0);
            }

            var prop_names = GetNames(shape);
            if (prop_names.Count != prop_count)
            {
                throw new AutomationException("Unexpected number of prop names");
            }

            var shape_data = UserDefinedCell.GetCells(shape);

            var list = new List<UserDefinedCell>(prop_count);
            for (int i = 0; i < prop_count; i++)
            {
                shape_data[i].Name = prop_names[i];
                list.Add(shape_data[i]);
            }

            return list;
        }
开发者ID:firestream99,项目名称:VisioAutomation,代码行数:37,代码来源:UserDefinedCellHelper.cs

示例5: PageComparer

 public PageComparer(Visio.Application app, Visio.Page page1, Visio.Page page2, Visio.Page resultPage)
 {
     _page1 = page1;
     _page2 = page2;
     _resultPage = resultPage;
     _app = app;
 }
开发者ID:blel,项目名称:Promoveo,代码行数:7,代码来源:PageComparer.cs

示例6: Duplicate

        public static void Duplicate(
            IVisio.Page src_page,
            IVisio.Page dest_page)
        {
            var app = src_page.Application;
            short copy_paste_flags = (short)IVisio.VisCutCopyPasteCodes.visCopyPasteNoTranslate;

            // handle the source page
            if (src_page == null)
            {
                throw new System.ArgumentNullException("src_page");
            }

            if (dest_page == null)
            {
                throw new System.ArgumentNullException("dest_page");
            }

            if (dest_page == src_page)
            {
                throw new VA.AutomationException("Destination Page cannot be Source Page");
            }

            if (src_page != app.ActivePage)
            {
                throw new VA.AutomationException("Source page must be active page.");
            }

            var src_page_shapes = src_page.Shapes;
            int num_src_shapes=src_page_shapes.Count;

            if (num_src_shapes > 0)
            {
                var active_window = app.ActiveWindow;
                active_window.SelectAll();
                var selection = active_window.Selection;
                selection.Copy(copy_paste_flags);
                active_window.DeselectAll();
            }

            var src_pagesheet = src_page.PageSheet;
            var pagecells = VA.Pages.PageCells.GetCells(src_pagesheet);

            // handle the dest page

            // first update all the page cells
            var dest_pagesheet = dest_page.PageSheet;
            var update = new VisioAutomation.ShapeSheet.Update();
            update.SetFormulas(pagecells);
            update.Execute(dest_pagesheet);

            // make sure the new page looks like the old page
            dest_page.Background = src_page.Background;

            // then paste any contents from the first page
            if (num_src_shapes>0)
            {
                dest_page.Paste(copy_paste_flags);
            }
        }
开发者ID:firestream99,项目名称:VisioAutomation,代码行数:60,代码来源:PageHelper.cs

示例7: connect

        private void connect(IVisio.Shape a, IVisio.Shape b, bool a_arrow, bool b_arrow)
        {
            var page = a.ContainingPage;
            var connectors_stencil = page.Application.Documents.OpenStencil("connec_u.vss");
            var connectors_masters = connectors_stencil.Masters;

            var dcm = connectors_masters["Dynamic Connector"];

            var drop_point = new VADRAW.Point(-2, -2);
            var c1 = page.Drop(dcm, drop_point);
            VACONNECT.ConnectorHelper.ConnectShapes(a, b, c1);

            //a.AutoConnect(b, connect_dir_none, null);

            if (a_arrow || b_arrow)
            {
                var update = new VASS.Update();
                if (a_arrow)
                {
                    update.SetFormula(c1.ID16, VASS.SRCConstants.BeginArrow, "13");                    
                }
                if (b_arrow)
                {
                    update.SetFormula(c1.ID16, VASS.SRCConstants.EndArrow, "13");
                }
                update.Execute(page);
            }
        }
开发者ID:shekharssorot2002,项目名称:VisioAutomation2.0,代码行数:28,代码来源:PathAnalysis_Tests.cs

示例8: SectionColumn

 internal SectionColumn(int ordinal, IVisio.VisSectionIndices section)
 {
     this.Name = ShapeSheetHelper.GetSectionName(section);
     this.Ordinal = ordinal;
     this.SectionIndex = section;
     this.CellColumns = new CellColumnList();
 }
开发者ID:shekharssorot2002,项目名称:VisioAutomation2.0,代码行数:7,代码来源:SectionColumn.cs

示例9: 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

示例10: Client

        public Client(IVisio.Application app, Context context)
        {
            if (context == null)
            {
                throw new System.ArgumentNullException();
            }
            this._context = context;
            this.VisioApplication = app;

            this.Application = new VA.Scripting.Commands.ApplicationCommands(this);
            this.View = new VA.Scripting.Commands.ViewCommands(this);
            this.Format = new VA.Scripting.Commands.FormatCommands(this);
            this.Layer = new VA.Scripting.Commands.LayerCommands(this);
            this.Control = new VA.Scripting.Commands.ControlCommands(this);
            this.CustomProp = new VA.Scripting.Commands.CustomPropCommands(this);
            this.Export = new VA.Scripting.Commands.ExportCommands(this);
            this.Connection = new VA.Scripting.Commands.ConnectionCommands(this);
            this.ConnectionPoint = new VA.Scripting.Commands.ConnectionPointCommands(this);
            this.Draw = new VA.Scripting.Commands.DrawCommands(this);
            this.Master = new VA.Scripting.Commands.MasterCommands(this);
            this.Arrange = new VA.Scripting.Commands.ArrangeCommands(this);
            this.Page = new VA.Scripting.Commands.PageCommands(this);
            this.Selection = new VA.Scripting.Commands.SelectionCommands(this);
            this.ShapeSheet = new VA.Scripting.Commands.ShapeSheetCommands(this);
            this.Text = new VA.Scripting.Commands.TextCommands(this);
            this.UserDefinedCell = new VA.Scripting.Commands.UserDefinedCellCommands(this);
            this.Document = new VA.Scripting.Commands.DocumentCommands(this);
            this.Developer = new VA.Scripting.Commands.DeveloperCommands(this);
            this.Output = new VA.Scripting.Commands.OutputCommands(this);
        }
开发者ID:firestream99,项目名称:VisioAutomation,代码行数:30,代码来源:Client.cs

示例11: BuildDiagram

        private static void BuildDiagram(Visio.Page page, List<Category> categories, List<Formula> formulae, List<Rule> rules, List<List> lists, List<Lookup> lookups)
        {
            Console.WriteLine("Drawing {0} categories...", categories.Count);
            DrawCategories(page, categories);

            Console.WriteLine("Drawing {0} rules...", rules.Count);
            DrawRules(page, rules);

            var listsToDraw = lists.Where(l => usedListNames.Contains(l.ListName.ToUpperInvariant()));
            Console.WriteLine("Drawing {0} lists...", listsToDraw.Count());
            DrawLists(page, listsToDraw);

            var lookupsToDraw = lookups.Where(l => usedLookupNames.Contains(l.TableName.ToUpperInvariant()));
            Console.WriteLine("Drawing {0} lookup tables...", lookupsToDraw.Count());
            DrawLookups(page, lookupsToDraw);

            var formulaeToDraw = formulae.Where(f => usedFormulaNames.Contains(f.FormulaName.ToUpperInvariant()));
            Console.WriteLine("Drawing {0} formulas...", formulaeToDraw.Count());
            DrawFormulae(page, formulaeToDraw);

            Console.WriteLine("Drawing {0} relations...", relations.Count);
            DrawRelations(page);

            Console.WriteLine();
            Console.WriteLine("Laying out the page...");
            page.Layout();

            Console.WriteLine("Resizing to fit to contents...");
            page.ResizeToFitContents();
        }
开发者ID:thijskuipers,项目名称:ExperlogixVisioDiagram,代码行数:30,代码来源:Program.cs

示例12: SectionQuery

 internal SectionQuery(CellQuery parent, int ordinal, IVisio.VisSectionIndices section)
 {
     this.Parent = parent;
        this.Ordinal = ordinal;
        this.SectionIndex = section;
        this.Columns = new ColumnList();
 }
开发者ID:firestream99,项目名称:VisioAutomation,代码行数:7,代码来源:CellQuery_SectionQuery.cs

示例13: Connector

 public Connector(BaseShape from, BaseShape to, IVisio.Master master)
     : base(master,-3,-3)
 {
     this.Master = new VA.DOM.MasterRef(master);
     this.From = from;
     this.To = to;
 }
开发者ID:firestream99,项目名称:VisioAutomation,代码行数:7,代码来源:Connector.cs

示例14: Set

        public static int Set(
            IVisio.Shape shape,
            short row,
            ControlCells ctrl)
        {
            if (shape == null)
            {
                throw new ArgumentNullException(nameof(shape));
            }

            if (!ctrl.XDynamics.Formula.HasValue)
            {
                ctrl.XDynamics = $"Controls.Row_{row + 1}";
            }

            if (!ctrl.YDynamics.Formula.HasValue)
            {
                ctrl.YDynamics = $"Controls.Row_{row + 1}.Y";
            }

            var update = new ShapeSheet.Update();
            update.SetFormulas(ctrl, row);
            update.Execute(shape);

            return row;
        }
开发者ID:firestream99,项目名称:VisioAutomation,代码行数:26,代码来源:ControlHelper.cs

示例15: Field

 public Field(IVisio.VisFieldCategories category, IVisio.VisFieldCodes code, IVisio.VisFieldFormats format)
     : base(NodeType.Field)
 {
     this.Category = category;
     this.Code = code;
     this.Format = format;
 }
开发者ID:firestream99,项目名称:VisioAutomation,代码行数:7,代码来源:Field.cs


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