示例#1
0
        public BaseForm()
        {
            StartPosition = FormStartPosition.CenterScreen;
            MinimumSize = new Size(150, 150);
            MaximumSize = new Size(900, 900);
            ClientSize = new Size(350, 350);

            _layeredWindow = new Layered.Window(this, Program.DefaultTheme, new Size(900, 900));
        }
示例#2
0
        public BaseForm()
        {
            StartPosition = FormStartPosition.CenterScreen;
            MinimumSize   = new Size(150, 150);
            MaximumSize   = new Size(900, 900);
            ClientSize    = new Size(350, 350);

            _layeredWindow = new Layered.Window(this, Program.DefaultTheme, new Size(900, 900));
        }
示例#3
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public Form()
        {
            // ...
            if (LayeredTheme == null)
            {
                var path = $"{Application.StartupPath}/{App.Settings.LayeredTheme}";
                if (File.Exists(path))
                {
                    using (var bitmap = new Bitmap(path)) {
                        LayeredTheme = new Layered.Theme(bitmap, App.Settings.LayeredInnerRectangle, App.Settings.LayeredMargin);
                    }
                }
            }

            // ...
            if (LayeredTheme != null)
            {
                LayeredWindow       = new Layered.Window(this, LayeredTheme, App.Settings.LayeredMaximumSize);
                OnWindowPosChanged += LayeredWindow.Update;
            }

            // ...
            Text              = App.Settings.Title;
            StartPosition     = App.Settings.FormStartPosition;
            Size              = App.Settings.WindowDefaultSize;
            BackColor         = App.Settings.WindowDefaultColor;
            WindowState       = PreviousFormWindowState = App.Settings.FormWindowState;
            MinimumSize       = App.Settings.WindowMinimumSize;
            FormBorderStyle   = FormBorderStyle.Sizable;
            AllowTransparency = false;

            // ...
            var icoPath = $"{Application.StartupPath}/{App.Settings.Icon}";

            Icon = File.Exists(icoPath) ? new Icon(icoPath) : Properties.Resources.AppIcon;

            // ...
            Controls.AddRange(new Control[] {
                CaptionGrip = new CaptionGrip(),

                new SideGrip(HitTestValues.TOP),
                new SideGrip(HitTestValues.BOTTOM),

                new SideGrip(HitTestValues.LEFT),
                new SideGrip(HitTestValues.RIGHT),
            });

            // ...
            var timer = new Timer();

            timer.Interval = 1000;
            timer.Tick    += (s, e) => {
                Controls.Add(Chromium = new Chromium(this));
                timer.Dispose();
            };
            timer.Start();
        }