Ejemplo n.º 1
0
        public Task StartAsync()
        {
            //System.Diagnostics.Debugger.Break();

            //create a form
            form = new System.Windows.Forms.Form();
            form.Size = new System.Drawing.Size(500, 500);

            //create a viewer object
            viewer = new GViewer();
            viewer.Dock = System.Windows.Forms.DockStyle.Fill;
            viewer.AutoScroll = false;
            //viewer.CurrentLayoutMethod = LayoutMethod.MDS;

            // control
            var b = CreateCommandButton();
            form.Controls.Add(b);
            b.BringToFront();

            viewer.ObjectUnderMouseCursorChanged += new EventHandler<Microsoft.Msagl.Drawing.ObjectUnderMouseCursorChangedEventArgs>(viewer_ObjectUnderMouseCursorChanged);
            viewer.MouseDown += new MouseEventHandler(viewer_MouseDown);
            viewer.SuspendLayout();

            form.SuspendLayout();
            form.Controls.Add(viewer as Control);

            viewer.ResumeLayout(false);
            form.ResumeLayout(false);

            viewer.Graph = graph;

            return Task.Run(() => form.ShowDialog());
        }