コード例 #1
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();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: ikenni/Layered
        private static void ThemeExample()
        {
            // ...
            var innerRectangle = new Rectangle(98, 78, 196, 196); // Layered.Template.InnerRectangle
            var margin = new Padding(-49, -49, -50, -50); // Layered.Template.Margin
            DefaultTheme = new Layered.Theme(Resources.ThemeMaterialShadow, innerRectangle, margin);

            // ...
            Resources.ThemeMaterialShadow.Dispose();
            Application.Run(new BaseForm());
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: masterheroit/Layered
        private static void ThemeExample()
        {
            // ...
            var innerRectangle = new Rectangle(98, 78, 196, 196);     // Layered.Template.InnerRectangle
            var margin         = new Padding(-49, -49, -50, -50);     // Layered.Template.Margin

            DefaultTheme = new Layered.Theme(Resources.ThemeMaterialShadow, innerRectangle, margin);

            // ...
            Resources.ThemeMaterialShadow.Dispose();
            Application.Run(new BaseForm());
        }