Example #1
0
 protected override void OnMouseUp(MouseEventArgs e)
 {
     base.OnMouseUp(e);
     if (e.Button == MouseButtons.Left)
     {
         SystemButtonManager.ProcessMouseOperate(e.Location, MouseOperate.Up);
     }
 }
Example #2
0
        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);
        }
Example #3
0
 public FormEx()
 {
     InitializeComponent();
     FormExIni();
     _systemButtonManager = new SystemButtonManager(this);
 }
Example #4
0
        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);
                }
            }
        }
Example #5
0
 protected override void OnMouseLeave(EventArgs e)
 {
     base.OnMouseLeave(e);
     SystemButtonManager.ProcessMouseOperate(Point.Empty, MouseOperate.Leave);
 }
Example #6
0
 protected override void OnMouseMove(MouseEventArgs e)
 {
     base.OnMouseMove(e);
     SystemButtonManager.ProcessMouseOperate(e.Location, MouseOperate.Move);
 }
Example #7
0
        private int _textShadowWidth = 4; //标题阴影的宽度

        #endregion Fields

        #region Constructors

        public FormEx()
        {
            InitializeComponent();
            FormExIni();
            _systemButtonManager = new SystemButtonManager(this);
        }
Example #8
0
        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);
        }