Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ZeroitMetroForm" /> class.
        /// </summary>
        public ZeroitMetroForm()
        {
            this._AccentColor             = Color.FromArgb(0, 122, 204);
            this._DrawBorders             = true;
            this._AllowResize             = true;
            this._State                   = ZeroitMetroForm.FormState.Normal;
            this._Style                   = Design.Style.Light;
            this._ResizeBorderWidth       = 6;
            this._TextRectangle           = new Rectangle(32, 7, checked (this.Width - 1), checked (this.Height - 1));
            this._resizeDir               = ZeroitMetroForm.ResizeDirection.None;
            this._HideBorderWhenMaximized = true;
            this._AlignTextToControlBox   = true;
            this._MainControlBox          = null;
            this._IsActive                = false;
            this._UseGradientBackColor    = false;
            Point point  = new Point(0, 0);
            Point point1 = new Point(this.Width, this.Height);

            this._GradientBrush   = new LinearGradientBrush(point, point1, Color.FromArgb(184, 43, 86), Color.FromArgb(94, 59, 149));
            this._FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            this.FormBorderStyle  = System.Windows.Forms.FormBorderStyle.None;
            this.BackColor        = Color.White;
            this.ForeColor        = Color.Black;
            this.Font             = new System.Drawing.Font("Segoe UI", 9f);
            this.SetStyle(ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
            this.UpdateStyles();
        }
Ejemplo n.º 2
0
        public void HideForm(Form form)
        {
            Height      = form.Height;
            Width       = form.Width;
            Location    = form.Location;
            borderStyle = form.FormBorderStyle;

            form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            form.Height          = 0;
            form.Width           = 0;
            form.Visible         = false;
        }
Ejemplo n.º 3
0
        private void ToggleFormFullScreen()
        {
            if (this.WindowState == FormWindowState.Maximized)
            {
                this.FormBorderStyle = this._border;
                this.WindowState     = this._windowstate;
            }
            else
            {
                this._border      = this.FormBorderStyle;
                this._windowstate = this.WindowState;

                this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                this.WindowState     = FormWindowState.Maximized;
            }
        }
Ejemplo n.º 4
0
        public static WindowStyle ToEto(this swf.FormBorderStyle style)
        {
            switch (style)
            {
            case swf.FormBorderStyle.Fixed3D:
            case swf.FormBorderStyle.Sizable:
            case swf.FormBorderStyle.SizableToolWindow:
            case swf.FormBorderStyle.FixedDialog:
                return(WindowStyle.Default);

            case swf.FormBorderStyle.None:
                return(WindowStyle.None);

            default:
                throw new NotSupportedException();
            }
        }
Ejemplo n.º 5
0
        public static bool IsResizable(this swf.FormBorderStyle style)
        {
            switch (style)
            {
            case swf.FormBorderStyle.Fixed3D:
            case swf.FormBorderStyle.FixedDialog:
            case swf.FormBorderStyle.FixedSingle:
            case swf.FormBorderStyle.FixedToolWindow:
            case swf.FormBorderStyle.None:
                return(false);

            case swf.FormBorderStyle.Sizable:
            case swf.FormBorderStyle.SizableToolWindow:
                return(true);

            default:
                throw new NotSupportedException();
            }
        }
 /// <summary>
 /// Goes to fullscreen or the old state.
 /// </summary>
 private void UpgradeFullscreen()
 {
     if (!fullscreen)
     {
         oldsize              = this.Size;
         oldstate             = this.WindowState;
         oldstyle             = this.FormBorderStyle;
         oldlocation          = this.Location;
         this.WindowState     = System.Windows.Forms.FormWindowState.Normal;
         this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
         this.Bounds          = System.Windows.Forms.Screen.PrimaryScreen.Bounds;
         fullscreen           = true;
     }
     else
     {
         this.Location        = oldlocation;
         this.WindowState     = oldstate;
         this.FormBorderStyle = oldstyle;
         this.Size            = oldsize;
         fullscreen           = false;
     }
 }
Ejemplo n.º 7
0
        private void ToggleFormFullScreen()
        {
            if (this.WindowState == FormWindowState.Maximized)
            {
                this.FormBorderStyle = this._border;
                this.WindowState = this._windowstate;
            }
            else
            {
                this._border = this.FormBorderStyle;
                this._windowstate = this.WindowState;

                this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                this.WindowState = FormWindowState.Maximized;
            }
        }
Ejemplo n.º 8
0
        public static swf.FormBorderStyle ToSWF(this WindowStyle style, bool resizable, swf.FormBorderStyle defaultStyle)
        {
            switch (style)
            {
            case WindowStyle.Default:
                return(resizable ? swf.FormBorderStyle.Sizable : defaultStyle);

            case WindowStyle.None:
                return(swf.FormBorderStyle.None);

            default:
                throw new NotSupportedException();
            }
        }