Пример #1
0
 void SizerMouseUp(object sender, MouseEventArgs e)
 {
     Aero.ChangeAccent(Handle, new Enums.AccentPolicy {
         GradientColor = 0xFD70000, AccentState = FormAccent
     });
     Opacity = 1.0;
     mov     = false;
 }
Пример #2
0
 private void Drag_MouseUp(object sender, MouseEventArgs e)
 {
     mouseDown = false;
     if (Drag)
     {
         Control cntrl = (Control)sender;
         Aero.ChangeAccent(Handle, new Enums.AccentPolicy {
             GradientColor = 0xFD70000, AccentState = FormAccent
         });
         this.Opacity = 1;
         cntrl.Cursor = Cursors.Default;
     }
 }
Пример #3
0
 private void Drag_MouseDown(object sender, MouseEventArgs e)
 {
     mouseDown    = true;
     lastLocation = e.Location;
     if (Drag)
     {
         Control cntrl = (Control)sender;
         Aero.ChangeAccent(Handle, new Enums.AccentPolicy {
             GradientColor = 0xFD70000, AccentState = Enums.AccentState.ACCENT_DISABLED
         });
         this.Opacity = 0.85;
         cntrl.Cursor = Cursors.Hand;
     }
 }
Пример #4
0
 void SizerMouseMove(object sender, MouseEventArgs e)
 {
     pbResize.Cursor = Resizer ? Cursors.SizeNWSE : Cursors.Default;
     if (mov && Resizer)
     {
         Aero.ChangeAccent(Handle, new Enums.AccentPolicy {
             GradientColor = 0xFD70000, AccentState = Enums.AccentState.ACCENT_DISABLED
         });
         this.Opacity = 0.85;
         int t_width  = MousePosition.X - Mx + Sw;
         int t_height = MousePosition.Y - My + Sh;
         if (t_width >= MinWidth)
         {
             Width = t_width;
         }
         if (t_height >= MinHeight)
         {
             Height = t_height;
         }
     }
 }
Пример #5
0
        private void WinForm_Load(object sender, EventArgs e)
        {
            this.Resize += new EventHandler(WinForm_Resize);

            #region Top Panel
            pnlTop.Size   = new Size(560, 30);
            pnlTop.Dock   = DockStyle.Top;
            pnlTop.Paint += new PaintEventHandler(pnlTop_Paint);
            AddDrag(pnlTop);
            //this.Controls.Add(pnlTop);
            #endregion

            #region Minimaze Button
            btnMinimaze.ForeColor = ForeColor;
            btnMinimaze.BackColor = pnlTop.BackColor;
            btnMinimaze.FlatStyle = FlatStyle.Flat;
            btnMinimaze.FlatAppearance.BorderSize         = 0;
            btnMinimaze.FlatAppearance.MouseDownBackColor = Color.FromArgb(44, 44, 44);
            btnMinimaze.FlatAppearance.MouseOverBackColor = Color.FromArgb(66, 66, 66);
            btnMinimaze.Size   = new Size(52, 30);
            btnMinimaze.Dock   = DockStyle.Right;
            btnMinimaze.Cursor = Cursors.Hand;
            btnMinimaze.Font   = new Font("Segoe UI Symbol", 9f);
            btnMinimaze.Text   = "─";
            btnMinimaze.Click += new EventHandler(Minimaze);
            pnlTop.Controls.Add(btnMinimaze);
            #endregion

            #region Maximize Button
            btnMaximize.ForeColor = ForeColor;
            btnMaximize.BackColor = pnlTop.BackColor;
            btnMaximize.FlatStyle = FlatStyle.Flat;
            btnMaximize.FlatAppearance.BorderSize         = 0;
            btnMaximize.FlatAppearance.MouseDownBackColor = Color.FromArgb(44, 44, 44);
            btnMaximize.FlatAppearance.MouseOverBackColor = Color.FromArgb(66, 66, 66);
            btnMaximize.Size   = new Size(52, 30);
            btnMaximize.Dock   = DockStyle.Right;
            btnMaximize.Cursor = Cursors.Hand;
            btnMaximize.Font   = new Font("Segoe UI Symbol", 9f);
            btnMaximize.Text   = "◻";
            btnMaximize.Click += new EventHandler(Maximize);
            pnlTop.Controls.Add(btnMaximize);
            #endregion

            #region Close Button
            btnClose.ForeColor = ForeColor;
            btnClose.BackColor = pnlTop.BackColor;
            btnClose.FlatStyle = FlatStyle.Flat;
            btnClose.FlatAppearance.BorderSize         = 0;
            btnClose.FlatAppearance.MouseDownBackColor = Color.DarkRed;
            btnClose.FlatAppearance.MouseOverBackColor = Color.Red;
            btnClose.Size   = new Size(52, 30);
            btnClose.Dock   = DockStyle.Right;
            btnClose.Cursor = Cursors.Hand;
            btnClose.Font   = new Font("Segoe UI Symbol", 9f);
            btnClose.Text   = "✕";
            btnClose.Click += new EventHandler(Close);
            pnlTop.Controls.Add(btnClose);
            #endregion

            #region Program (Picturebox for Icon)
            pbProgram.SizeMode = PictureBoxSizeMode.Zoom;
            pbProgram.Location = new Point(4, 2);
            pbProgram.Size     = new Size(24, 24);
            pbProgram.Image    = this.Icon.ToBitmap();
            AddDrag(pbProgram);
            pnlTop.Controls.Add(pbProgram);
            #endregion

            //#region Program (Label -> Title)
            //if (this.Icon != null && ShowControlBarIcon)
            //{
            //    lblProgram.Location = new Point(33, 8);
            //}
            //else
            //{
            //    lblProgram.Location = new Point(5, 8);
            //}
            //lblProgram.ForeColor = ForeColor;
            //AddDrag(lblProgram);
            //pnlTop.Controls.Add(lblProgram);
            //#endregion

            #region ResizeGrip (Picturebox)
            pbResize.MouseDown += SizerMouseDown;
            pbResize.MouseMove += SizerMouseMove;
            pbResize.MouseUp   += SizerMouseUp;
            pbResize.Size       = new Size(ResizeGripSize, ResizeGripSize);
            pbResize.BackColor  = Color.Transparent;
            pbResize.Location   = new Point(this.Width - pbResize.Size.Width, this.Height - pbResize.Size.Height);
            //pbResize.Cursor = Cursors.SizeNWSE;
            this.Controls.Add(pbResize);
            pbResize.BringToFront();
            #endregion

            #region Extra
            Aero.ChangeAccent(Handle, new Enums.AccentPolicy {
                GradientColor = 0xFD70000, AccentState = FormAccent
            });
            if (ExtraDropShadow)
            {
                Shadow.AddShadow(Handle);
            }
            #endregion
        }