コード例 #1
0
        //********************************************************************
        public void LoadPref()
        {
            JsonPref pref = new JsonPref("pf");

            bool  ok = false;
            Point p  = pref.GetPoint("Point", out ok);

            if (ok)
            {
                this.Location = p;
            }
            Size sz = pref.GetSize("Size", out ok);

            if (ok)
            {
                this.Size = sz;
            }
            int pn = pref.GetInt("pv_now", out ok);

            if (ok)
            {
                pv_now = (pv_Mode)pn;
            }
        }
コード例 #2
0
        //********************************************************************
        public void SetDispMode(pv_Mode md)
        {
            this.SuspendLayout();
            ModeNav.Checked     = false;
            ModeView.Checked    = false;
            ModeViewNav.Checked = false;
            ModeNavView.Checked = false;

            int inter = 2;
            int th    = toolStrip1.Height;
            int sh    = statusStrip1.Height;
            int ww    = this.Width - this.ClientSize.Width;
            int hh    = this.Height - this.ClientSize.Height;
            int MinH  = hh + th + sh + gbNav.Height;

            switch (md)
            {
            case pv_Mode.nav:
                pv_now          = pv_Mode.nav;
                ModeMenu.Text   = "Nav";
                ModeNav.Checked = true;
                ShowToolStripBtn(false);
                pictureView1.Enabled = pictureView1.Visible = false;
                gbNav.Anchor         = AnchorStyles.Left | AnchorStyles.Top;
                gbNav.Enabled        = gbNav.Visible = true;
                gbNav.Top            = th + inter;
                gbNav.Left           = inter;
                orgSize = new System.Drawing.Size(this.Width, this.Height);
                int www = gbNav.Width + inter + inter + ww;
                int hhh = gbNav.Height + inter + inter + th + sh + hh;
                this.MaximumSize     =
                    this.MinimumSize = new Size(www, hhh);
                this.Width           = www;
                this.Height          = hhh;
                break;

            case pv_Mode.view:
                pv_now        = pv_Mode.view;
                ModeMenu.Text = "View";
                ShowToolStripBtn(true);
                ModeView.Checked     = true;
                pictureView1.Anchor  = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom;
                pictureView1.Enabled = pictureView1.Visible = true;
                gbNav.Enabled        = gbNav.Visible = false;
                this.MaximumSize     = new Size(0, 0);
                this.MinimumSize     = new Size(200, 100);
                if (orgSize.Width != 0)
                {
                    Width   = orgSize.Width;
                    Height  = orgSize.Height;
                    orgSize = new Size(0, 0);
                }

                pictureView1.Top    = th + inter;
                pictureView1.Left   = inter;
                pictureView1.Width  = ClientSize.Width - inter - inter;
                pictureView1.Height = ClientSize.Height - (th + sh + inter + inter);
                break;

            case pv_Mode.navView:
                ModeMenu.Text = "Nav + View";
                pv_now        = pv_Mode.navView;
                ShowToolStripBtn(true);
                ModeNavView.Checked  = true;
                pictureView1.Enabled = pictureView1.Visible = true;
                pictureView1.Anchor  = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom;
                gbNav.Anchor         = AnchorStyles.Left | AnchorStyles.Top;
                gbNav.Enabled        = gbNav.Visible = true;
                this.MaximumSize     = new Size(0, 0);
                this.MinimumSize     = new Size(gbNav.Width + 200, MinH);
                if (orgSize.Width != 0)
                {
                    Width   = orgSize.Width;
                    Height  = orgSize.Height;
                    orgSize = new Size(0, 0);
                }
                gbNav.Top           = th + inter;
                gbNav.Left          = inter;
                pictureView1.Top    = th + inter;
                pictureView1.Left   = gbNav.Left + gbNav.Width + inter;
                pictureView1.Width  = ClientSize.Width - (gbNav.Width + inter * 3);
                pictureView1.Height = ClientSize.Height - (th + sh + inter + inter);
                break;

            case pv_Mode.viewNav:
            default:
                ModeMenu.Text = "View + Nav";
                pv_now        = pv_Mode.viewNav;
                ShowToolStripBtn(true);
                ModeViewNav.Checked  = true;
                pictureView1.Enabled = pictureView1.Visible = true;
                pictureView1.Anchor  = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom;
                gbNav.Anchor         = AnchorStyles.Right | AnchorStyles.Top;
                gbNav.Enabled        = gbNav.Visible = true;
                this.MaximumSize     = new Size(0, 0);
                this.MinimumSize     = new Size(gbNav.Width + 200, MinH);
                if (orgSize.Width != 0)
                {
                    Width   = orgSize.Width;
                    Height  = orgSize.Height;
                    orgSize = new Size(0, 0);
                }
                pictureView1.Top    = th + inter;
                pictureView1.Left   = inter;
                pictureView1.Width  = ClientSize.Width - (gbNav.Width + inter * 3);
                pictureView1.Height = ClientSize.Height - (th + sh + inter + inter);
                gbNav.Top           = th + inter;
                gbNav.Left          = pictureView1.Left + pictureView1.Width + inter;
                break;
            }
            this.ResumeLayout();
        }