using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace SeSue.Forms.Visualization
{
    public partial class Network : Form
    {
        private int startW;
        private int startH;

        public Network(Form parent, Microsoft.Glee.GraphViewerGdi.GViewer viewer, string formText, int w, int h)
        {
            this.WindowState = parent.WindowState;
            this.startW = w;
            this.startH = h;
            if (this.WindowState != FormWindowState.Maximized) { this.Width = w; this.Height = h; }
            InitializeComponent();
            
            

            this.Text = formText;
            viewer.Dock = System.Windows.Forms.DockStyle.Fill;
            this.Controls.Add(viewer);
            this.StartPosition = FormStartPosition.Manual;
            this.Icon = SeSue.Properties.Resources.logo;
        }


        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);
            this.Width = this.startW;
            this.Height = this.startH;
            if (Owner != null && StartPosition == FormStartPosition.Manual)
            {
                int offset = Owner.OwnedForms.Length * 38;  // approx. 10mm
                offset = 0;
                Point p = new Point(Owner.Left + Owner.Width / 2 - Width / 2 + offset, Owner.Top + Owner.Height / 2 - Height / 2 + offset);
                this.Location = p;
            }
        }
    }
}
