protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); if (e.Button == MouseButtons.Left) { SystemButtonManager.ProcessMouseOperate(e.Location, MouseOperate.Up); } }
protected override void Dispose(bool disposing) { if (disposing) { if (_systemButtonManager != null) { _systemButtonManager.Dispose(); _systemButtonManager = null; _formFringe.Dispose(); _formFringe = null; _textFont.Dispose(); _textFont = null; if (_formBkg != null) { _formBkg.Dispose(); _formBkg = null; } } } base.Dispose(disposing); }
protected override void OnPaint(PaintEventArgs e) { e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; g = e.Graphics; //draw BackgroundImage if (BackgroundImage != null) { switch (BackgroundImageLayout) { case ImageLayout.Stretch: case ImageLayout.Zoom: e.Graphics.DrawImage( _formBkg, ClientRectangle, new Rectangle(0, 0, _formBkg.Width, _formBkg.Height), GraphicsUnit.Pixel); break; case ImageLayout.Center: case ImageLayout.None: case ImageLayout.Tile: e.Graphics.DrawImage( _formBkg, ClientRectangle, ClientRectangle, GraphicsUnit.Pixel); break; } } else { bmpFormExBack = (Bitmap)ServiceStationClient.ComponentUI.Properties.Resources.window; imageAttr = new ImageAttributes(); imageAttr.SetColorKey(bmpFormExBack.GetPixel(1, 1), bmpFormExBack.GetPixel(1, 1)); g.DrawImage(bmpFormExBack, new Rectangle(0, 0, 5, 31), 0, 0, 5, 31, GraphicsUnit.Pixel); g.DrawImage(bmpFormExBack, new Rectangle(5, 0, this.Width - 10, 31), 5, 0, bmpFormExBack.Width - 10, 31, GraphicsUnit.Pixel); g.DrawImage(bmpFormExBack, new Rectangle(this.Width - 5, 0, 5, 31), bmpFormExBack.Width - 5, 0, 5, 31, GraphicsUnit.Pixel); g.DrawImage(bmpFormExBack, new Rectangle(0, 31, 5, this.Height - 36), 0, 31, 5, bmpFormExBack.Height - 36, GraphicsUnit.Pixel); g.DrawImage(bmpFormExBack, new Rectangle(5, 31, this.Width - 8, this.Height - 36), 5, 31, 5, bmpFormExBack.Height - 36, GraphicsUnit.Pixel); g.DrawImage(bmpFormExBack, new Rectangle(this.Width - 5, 31, 5, this.Height - 36), bmpFormExBack.Width - 5, 31, 5, bmpFormExBack.Height - 36, GraphicsUnit.Pixel); g.DrawImage(bmpFormExBack, new Rectangle(0, this.Height - 5, 5, 5), 0, bmpFormExBack.Height - 5, 5, 5, GraphicsUnit.Pixel); g.DrawImage(bmpFormExBack, new Rectangle(5, this.Height - 5, this.Width - 10, 5), 5, bmpFormExBack.Height - 5, bmpFormExBack.Width - 10, 5, GraphicsUnit.Pixel); g.DrawImage(bmpFormExBack, new Rectangle(this.Width - 5, this.Height - 5, 5, 5), bmpFormExBack.Width - 5, bmpFormExBack.Height - 5, 5, 5, GraphicsUnit.Pixel); } //draw system buttons SystemButtonManager.DrawSystemButtons(e.Graphics); //draw fringe CommonMethod.DrawFormFringe(this, e.Graphics, _formFringe, Radius); //draw icon if (Icon != null && ShowIconInTitle) { e.Graphics.DrawIcon(Icon, IconRect); } //draw text if (Text.Length != 0 && ShowTitle) { if (TextWithShadow) { //using (Image textImg = CommonMethod.GetStringImgWithShadowEffect(Text, TextFont, TextForeColor, TextShadowColor, TextShadowWidth)) //{ // e.Graphics.DrawImage(textImg, TextRect.Location); //} } else { TextRenderer.DrawText( e.Graphics, Text, TextFont, TextRect, TextForeColor, TextFormatFlags.SingleLine | TextFormatFlags.EndEllipsis); } } }
protected override void OnMouseLeave(EventArgs e) { base.OnMouseLeave(e); SystemButtonManager.ProcessMouseOperate(Point.Empty, MouseOperate.Leave); }
protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); SystemButtonManager.ProcessMouseOperate(e.Location, MouseOperate.Move); }
public FormEx() { InitializeComponent(); FormExIni(); _systemButtonManager = new SystemButtonManager(this); }