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); }
public FormEx() { InitializeComponent(); FormExIni(); _systemButtonManager = new SystemButtonManager(this); }
protected override void OnPaint(PaintEventArgs e) { e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; //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; } } //draw system buttons SystemButtonManager.DrawSystemButtons(e.Graphics); //draw fringe RenderHelper.DrawFormFringe(this, e.Graphics, _formFringe, Radius); //draw icon if (Icon != null && ShowIcon) { e.Graphics.DrawIcon(Icon, IconRect); } //draw text if (Text.Length != 0) { if (TextWithShadow) { using (Image textImg = RenderHelper.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); }
private int _textShadowWidth = 4; //标题阴影的宽度 #endregion Fields #region Constructors public FormEx() { InitializeComponent(); FormExIni(); _systemButtonManager = new SystemButtonManager(this); }
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); }