private void ButtonClose_MouseUp(object sender, MouseEventArgs e) { if (!ButtonClose.IsDisposed) { closeBmp = ResClass.GetResObj("btn_close_normal"); ButtonClose.Invalidate(); } }
private void ButtonMax_MouseUp(object sender, MouseEventArgs e) { maxBmp = ResClass.GetResObj("btn_max_normal"); if (this.WindowState == FormWindowState.Maximized) { maxBmp = ResClass.GetResObj("btn_restore_normal"); } ButtonMax.Invalidate(); }
private void ButtonMax_MouseDown(object sender, MouseEventArgs e) { g = ButtonMax.CreateGraphics(); maxBmp = ResClass.GetResObj("btn_max_down"); if (this.WindowState == FormWindowState.Maximized) { maxBmp = ResClass.GetResObj("btn_restore_down"); } g.DrawImage(maxBmp, new Rectangle(0, 0, maxBmp.Width, maxBmp.Height), 0, 0, maxBmp.Width, maxBmp.Height, GraphicsUnit.Pixel); }
private void ButtonMax_MouseEnter(object sender, EventArgs e) { g = ButtonMax.CreateGraphics(); maxBmp = ResClass.GetResObj("btn_max_highlight"); toolTip1.SetToolTip(ButtonMax, "最大化"); if (this.WindowState == FormWindowState.Maximized) { maxBmp = ResClass.GetResObj("btn_restore_highlight"); toolTip1.SetToolTip(ButtonMax, "还原"); } g.DrawImage(maxBmp, new Rectangle(0, 0, maxBmp.Width, maxBmp.Height), 0, 0, maxBmp.Width, maxBmp.Height, GraphicsUnit.Pixel); }
private void ButtonMax_Paint(object sender, PaintEventArgs e) { if (this.MaximizeBox) { g = e.Graphics; maxBmp = ResClass.GetResObj("btn_max_normal"); if (this.WindowState == FormWindowState.Maximized) { maxBmp = ResClass.GetResObj("btn_restore_normal"); } g.DrawImage(maxBmp, new Rectangle(0, 0, maxBmp.Width, maxBmp.Height), 0, 0, maxBmp.Width, maxBmp.Height, GraphicsUnit.Pixel); } }
public BasicForm() { this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); InitializeComponent(); this.MaximumSize = Screen.PrimaryScreen.WorkingArea.Size; closeBmp = ResClass.GetResObj("btn_close_normal"); minBmp = ResClass.GetResObj("btn_mini_normal"); maxBmp = ResClass.GetResObj("btn_max_normal"); if (this.WindowState == FormWindowState.Maximized) { maxBmp = ResClass.GetResObj("btn_restore_normal"); } }
protected override void OnPaint(PaintEventArgs e) { g = e.Graphics; Bmp = ResClass.GetResObj("window"); Bmp = (Bitmap)Util.ProcImage(Bmp, colorA, grayC, lightB); imageAttr = new ImageAttributes(); imageAttr.SetColorKey(Bmp.GetPixel(1, 1), Bmp.GetPixel(1, 1)); g.DrawImage(Bmp, new Rectangle(1, 1, 5, 31), 0, 0, 5, 31, GraphicsUnit.Pixel); g.DrawImage(Bmp, new Rectangle(6, 1, this.Width - 12, 31), 5, 0, Bmp.Width - 10, 31, GraphicsUnit.Pixel); g.DrawImage(Bmp, new Rectangle(this.Width - 6, 1, 5, 31), Bmp.Width - 5, 0, 5, 31, GraphicsUnit.Pixel); g.DrawImage(Bmp, new Rectangle(1, 32, 5, this.Height - 38), 0, 31, 5, Bmp.Height - 36, GraphicsUnit.Pixel); g.DrawImage(Bmp, new Rectangle(6, 32, this.Width - 10, this.Height - 38), 5, 31, 5, Bmp.Height - 36, GraphicsUnit.Pixel); g.DrawImage(Bmp, new Rectangle(this.Width - 6, 32, 5, this.Height - 38), Bmp.Width - 5, 31, 5, Bmp.Height - 36, GraphicsUnit.Pixel); g.DrawImage(Bmp, new Rectangle(1, this.Height - 6, 5, 5), 0, Bmp.Height - 5, 5, 5, GraphicsUnit.Pixel); g.DrawImage(Bmp, new Rectangle(6, this.Height - 6, this.Width - 12, 5), 5, Bmp.Height - 5, Bmp.Width - 10, 5, GraphicsUnit.Pixel); g.DrawImage(Bmp, new Rectangle(this.Width - 6, this.Height - 6, 5, 5), Bmp.Width - 5, Bmp.Height - 5, 5, 5, GraphicsUnit.Pixel); //g.DrawImage(closeBmp, new Rectangle(this.Width - closeBmp.Width-1, 0, closeBmp.Width, closeBmp.Height), 0, 0, closeBmp.Width, closeBmp.Height, GraphicsUnit.Pixel); g.DrawIcon(this.Icon, new Rectangle(7, 7, 18, 18)); g.DrawString(this.Text, new Font("微软雅黑", 10F, FontStyle.Bold), titleColor, 26, 7); }
private void ButtonMin_MouseLeave(object sender, EventArgs e) { minBmp = ResClass.GetResObj("btn_mini_normal"); ButtonMin.Invalidate(); }
private void ButtonMin_MouseUp(object sender, MouseEventArgs e) { minBmp = ResClass.GetResObj("btn_close_normal"); ButtonMin.Invalidate(); }
private void ButtonMin_MouseDown(object sender, MouseEventArgs e) { minBmp = ResClass.GetResObj("btn_mini_down"); ButtonMin.Invalidate(); }
private void ButtonMin_MouseEnter(object sender, EventArgs e) { minBmp = ResClass.GetResObj("btn_mini_highlight"); toolTip1.SetToolTip(ButtonMin, "最小化"); ButtonMin.Invalidate(); }
private void ButtonClose_MouseEnter(object sender, EventArgs e) { closeBmp = ResClass.GetResObj("btn_close_highlight"); toolTip1.SetToolTip(ButtonClose, "关闭"); ButtonClose.Invalidate(); }
private void ButtonClose_MouseLeave(object sender, EventArgs e) { closeBmp = ResClass.GetResObj("btn_close_normal"); ButtonClose.Invalidate(); }
private void ButtonClose_MouseDown(object sender, MouseEventArgs e) { closeBmp = ResClass.GetResObj("btn_close_down"); ButtonClose.Invalidate(); }