public static void MonitorResolutions()
        {
            var resolutions = new List<ResolutionInfo>
            {
                new ResolutionInfo("VGA","4:3",640,480),
                new ResolutionInfo("SVGA","4:3",800,600),
                new ResolutionInfo("WSVGA","~17:10",1024,600),
                new ResolutionInfo("XGA","4:3",1024,768),
                new ResolutionInfo("XGA+","4:3",1152,864),
                new ResolutionInfo("WXGA","16:9",1280,720),
                new ResolutionInfo("WXGA","5:3",1280,768),
                new ResolutionInfo("WXGA","16:10",1280,800),
                new ResolutionInfo("SXGA–(UVGA)","4:3",1280,960),
                new ResolutionInfo("SXGA","5:4",1280,1024),
                new ResolutionInfo("HD","~16:9",1360,768),
                new ResolutionInfo("HD","~16:9",1366,768),
                new ResolutionInfo("SXGA+","4:3",1400,1050),
                new ResolutionInfo("WXGA+","16:10",1440,900),
                new ResolutionInfo("HD+","16:9",1600,900),
                new ResolutionInfo("UXGA","4:3",1600,1200),
                new ResolutionInfo("WSXGA+","16:10",1680,1050),
                new ResolutionInfo("FHD","16:9",1920,1080),
                new ResolutionInfo("WUXGA","16:10",1920,1200),
                new ResolutionInfo("QWXGA","16:9",2048,1152),
                new ResolutionInfo("WQHD","16:9",2560,1440),
                new ResolutionInfo("WQXGA","16:10",2560,1600),
                new ResolutionInfo("Unknown","3:4",768,1024),
                new ResolutionInfo("Unknown","16:9",1093,614),
                new ResolutionInfo("Unknown","~16:9",1311,737)
            };

            var doc = SampleEnvironment.Application.ActiveDocument;

            var fonts = doc.Fonts;

            var segoe_ui_font = fonts["Segoe UI"];
            var segoe_ui__light_font = fonts["Segoe UI Light"];
            var segoe_ui_font_id = segoe_ui_font.ID;
            var segoe_ui__light_font_id = segoe_ui__light_font.ID;

            var renderer = new VA.Models.Forms.InteractiveRenderer(doc);

            var formpage = new VA.Models.Forms.FormPage();
            var page = renderer.CreatePage(formpage);

            double max_body_width = 30.0;
            var page_title = renderer.AddShape(max_body_width, 1.5, "Standard Resolutions by Aspect Ratio");
            page_title.CharacterCells.Font = segoe_ui__light_font_id;
            page_title.CharacterCells.Size = "100pt";
            page_title.ParagraphCells.HorizontalAlign = 0;
            page_title.FormatCells.LineWeight = 0;
            page_title.FormatCells.LinePattern = 0;
            //page_title.FormatCells.FillForegnd = "RGB(240,240,240)"; renderer.Linefeed(0.5);
            renderer.Linefeed(0);

            var grouped = resolutions.GroupBy(i => i.AspectRatioName).ToList();
            foreach (var group in grouped)
            {
                var group_title = renderer.AddShape(max_body_width, 1, group.Key);
               group_title.CharacterCells.Font = segoe_ui__light_font_id;
               group_title.CharacterCells.Size = "50pt";
               group_title.ParagraphCells.HorizontalAlign = 0;
               group_title.FormatCells.LineWeight = 0;
               group_title.FormatCells.LinePattern = 0;
               group_title.FormatCells.FillForegnd = "RGB(250,250,250)";

               renderer.Linefeed(0.5);

                foreach (var resolution in group)
                {
                    double w = resolution.Width / 400.0;
                    double h = resolution.Height / 400.0;

                    string label = string.Format("{0}\n{1}x{2}", resolution.Name, resolution.Width, resolution.Height);
                    var res_title = renderer.AddShape(w, h, label);
                    res_title.CharacterCells.Font = segoe_ui_font_id;
                    res_title.CharacterCells.Size = "25pt";
                    //res_title.ParagraphCells.HorizontalAlign = 0;
                    //res_title.FormatCells.LineWeight = 0;
                    //res_title.FormatCells.LinePattern = 0;
                    res_title.FormatCells.FillForegnd = "RGB(240,240,240)";
                    renderer.MoveRight(0.5);
                }
                renderer.Linefeed(1);
            }
            renderer.Finish();
            page.ResizeToFitContents();
        }
Ejemplo n.º 2
0
        public IVisio.Document DrawInteropEnumDocumentation()
        {
            this.AssertApplicationAvailable();

            var formdoc = new VA.Models.Forms.FormDocument();

            var helpstr   = new System.Text.StringBuilder();
            int chunksize = 70;

            var interop_enums = VA.Interop.InteropHelper.GetEnums();
            int pagecount     = 0;

            foreach (var enum_ in interop_enums)
            {
                int chunkcount = 0;

                var values = enum_.Values.OrderBy(i => i.Name).ToList();
                foreach (var chunk in Chunk(values, chunksize))
                {
                    helpstr.Length = 0;
                    foreach (var val in chunk)
                    {
                        helpstr.AppendFormat("0x{0}\t{1}\n", val.Value.ToString("x"), val.Name);
                    }

                    var formpage = new VA.Models.Forms.FormPage();
                    formpage.Size   = new VA.Drawing.Size(8.5, 11);
                    formpage.Margin = new VA.Drawing.Margin(0.5, 0.5, 0.5, 0.5);
                    formpage.Title  = enum_.Name;
                    formpage.Body   = helpstr.ToString();
                    if (chunkcount == 0)
                    {
                        formpage.Name = string.Format("{0}", enum_.Name);
                    }
                    else
                    {
                        formpage.Name = string.Format("{0} ({1})", enum_.Name, chunkcount + 1);
                    }

                    //docbuilder.BodyParaSpacingAfter = 2.0;

                    formpage.BodyTextSize = 8.0;

                    formdoc.Pages.Add(formpage);


                    var tabstops = new[]
                    {
                        new VA.Text.TabStop(1.5, VA.Text.TabStopAlignment.Left)
                    };

                    //VA.Text.TextFormat.SetTabStops(docpage.VisioBodyShape, tabstops);

                    chunkcount++;
                    pagecount++;
                }
            }

            formdoc.Subject = "Visio Interop Enum Documenation";
            formdoc.Title   = "Visio Interop Enum Documenation";
            formdoc.Creator = "";
            formdoc.Company = "";

            //hide_ui_stuff(docbuilder.VisioDocument);


            var doc = formdoc.Render(this.Client.VisioApplication);

            return(doc);
        }
Ejemplo n.º 3
0
        public static void MonitorResolutions()
        {
            var resolutions = new List <ResolutionInfo>
            {
                new ResolutionInfo("VGA", "4:3", 640, 480),
                new ResolutionInfo("SVGA", "4:3", 800, 600),
                new ResolutionInfo("WSVGA", "~17:10", 1024, 600),
                new ResolutionInfo("XGA", "4:3", 1024, 768),
                new ResolutionInfo("XGA+", "4:3", 1152, 864),
                new ResolutionInfo("WXGA", "16:9", 1280, 720),
                new ResolutionInfo("WXGA", "5:3", 1280, 768),
                new ResolutionInfo("WXGA", "16:10", 1280, 800),
                new ResolutionInfo("SXGA–(UVGA)", "4:3", 1280, 960),
                new ResolutionInfo("SXGA", "5:4", 1280, 1024),
                new ResolutionInfo("HD", "~16:9", 1360, 768),
                new ResolutionInfo("HD", "~16:9", 1366, 768),
                new ResolutionInfo("SXGA+", "4:3", 1400, 1050),
                new ResolutionInfo("WXGA+", "16:10", 1440, 900),
                new ResolutionInfo("HD+", "16:9", 1600, 900),
                new ResolutionInfo("UXGA", "4:3", 1600, 1200),
                new ResolutionInfo("WSXGA+", "16:10", 1680, 1050),
                new ResolutionInfo("FHD", "16:9", 1920, 1080),
                new ResolutionInfo("WUXGA", "16:10", 1920, 1200),
                new ResolutionInfo("QWXGA", "16:9", 2048, 1152),
                new ResolutionInfo("WQHD", "16:9", 2560, 1440),
                new ResolutionInfo("WQXGA", "16:10", 2560, 1600),
                new ResolutionInfo("Unknown", "3:4", 768, 1024),
                new ResolutionInfo("Unknown", "16:9", 1093, 614),
                new ResolutionInfo("Unknown", "~16:9", 1311, 737)
            };

            var doc = SampleEnvironment.Application.ActiveDocument;

            var fonts = doc.Fonts;

            var segoe_ui_font           = fonts["Segoe UI"];
            var segoe_ui__light_font    = fonts["Segoe UI Light"];
            var segoe_ui_font_id        = segoe_ui_font.ID;
            var segoe_ui__light_font_id = segoe_ui__light_font.ID;

            var renderer = new VA.Models.Forms.InteractiveRenderer(doc);

            var formpage = new VA.Models.Forms.FormPage();
            var page     = renderer.CreatePage(formpage);

            double max_body_width = 30.0;
            var    page_title     = renderer.AddShape(max_body_width, 1.5, "Standard Resolutions by Aspect Ratio");

            page_title.CharacterCells.Font            = segoe_ui__light_font_id;
            page_title.CharacterCells.Size            = "100pt";
            page_title.ParagraphCells.HorizontalAlign = 0;
            page_title.FormatCells.LineWeight         = 0;
            page_title.FormatCells.LinePattern        = 0;
            //page_title.FormatCells.FillForegnd = "RGB(240,240,240)"; renderer.Linefeed(0.5);
            renderer.Linefeed(0);

            var grouped = resolutions.GroupBy(i => i.AspectRatioName).ToList();

            foreach (var group in grouped)
            {
                var group_title = renderer.AddShape(max_body_width, 1, group.Key);
                group_title.CharacterCells.Font            = segoe_ui__light_font_id;
                group_title.CharacterCells.Size            = "50pt";
                group_title.ParagraphCells.HorizontalAlign = 0;
                group_title.FormatCells.LineWeight         = 0;
                group_title.FormatCells.LinePattern        = 0;
                group_title.FormatCells.FillForegnd        = "RGB(250,250,250)";

                renderer.Linefeed(0.5);

                foreach (var resolution in group)
                {
                    double w = resolution.Width / 400.0;
                    double h = resolution.Height / 400.0;

                    string label     = string.Format("{0}\n{1}x{2}", resolution.Name, resolution.Width, resolution.Height);
                    var    res_title = renderer.AddShape(w, h, label);
                    res_title.CharacterCells.Font = segoe_ui_font_id;
                    res_title.CharacterCells.Size = "25pt";
                    //res_title.ParagraphCells.HorizontalAlign = 0;
                    //res_title.FormatCells.LineWeight = 0;
                    //res_title.FormatCells.LinePattern = 0;
                    res_title.FormatCells.FillForegnd = "RGB(240,240,240)";
                    renderer.MoveRight(0.5);
                }
                renderer.Linefeed(1);
            }
            renderer.Finish();
            page.ResizeToFitContents();
        }
Ejemplo n.º 4
0
        public IVisio.Document DrawScriptingDocumentation()
        {
            this.AssertApplicationAvailable();

            var formdoc = new VA.Models.Forms.FormDocument();

            formdoc.Subject = "VisioAutomation.Scripting Documenation";
            formdoc.Title   = "VisioAutomation.Scripting Documenation";
            formdoc.Creator = "";
            formdoc.Company = "";

            //docbuilder.BodyParaSpacingAfter = 6.0;
            var lines = new List <string>();

            var cmdst_props = VA.Scripting.Client.GetCommandSetProperties().OrderBy(i => i.Name).ToList();
            var sb          = new System.Text.StringBuilder();
            var helpstr     = new System.Text.StringBuilder();

            foreach (var cmdset_prop in cmdst_props)
            {
                var cmdset_type = cmdset_prop.PropertyType;

                // Calculate the text
                var methods = CommandSet.GetCommandMethods(cmdset_type);
                lines.Clear();
                foreach (var method in methods)
                {
                    sb.Length = 0;
                    var method_params = method.GetParameters();
                    TextCommandsUtil.Join(sb, ", ", method_params.Select(param => string.Format("{0} {1}", ReflectionUtil.GetNiceTypeName(param.ParameterType), param.Name)));

                    if (method.ReturnType != typeof(void))
                    {
                        string line = string.Format("{0}({1}) -> {2}", method.Name, sb, ReflectionUtil.GetNiceTypeName(method.ReturnType));
                        lines.Add(line);
                    }
                    else
                    {
                        string line = string.Format("{0}({1})", method.Name, sb);
                        lines.Add(line);
                    }
                }

                lines.Sort();

                helpstr.Length = 0;
                TextCommandsUtil.Join(helpstr, "\r\n", lines);

                var formpage = new VisioAutomation.Models.Forms.FormPage();
                formpage.Title  = cmdset_prop.Name + " commands";
                formpage.Body   = helpstr.ToString();
                formpage.Name   = cmdset_prop.Name + " commands";
                formpage.Size   = new VA.Drawing.Size(8.5, 11);
                formpage.Margin = new VA.Drawing.Margin(0.5, 0.5, 0.5, 0.5);
                formdoc.Pages.Add(formpage);
            }


            //hide_ui_stuff(docbuilder.VisioDocument);

            var app = this.Client.VisioApplication;
            var doc = formdoc.Render(app);

            return(doc);
        }