Exemple #1
0
 protected override void OnMouseUp(MouseEventArgs e)
 {
     base.OnMouseUp(e);
     if (e.Button == MouseButtons.Left)
     {
         SysBtnManager.ProcessMouseOperate(e.Location, NuiMouseOperate.LeftUp);
     }
 }
Exemple #2
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (m_sysBtnManager != null)
                {
                    m_sysBtnManager.Dispose();
                    m_sysBtnManager = null;

                    m_formFringe.Dispose();
                    m_formFringe = null;

                    m_textFont.Dispose();
                    m_textFont = null;

                    if (m_formBkg != null)
                    {
                        m_formBkg.Dispose();
                        m_formBkg = null;
                    }
                }
            }
            base.Dispose(disposing);
        }
Exemple #3
0
        private SysBtnManager m_sysBtnManager;                                     // 系统按钮管理器

        public NuiForm()
        {
            InitializeComponent();
            NuiFormIni();
            m_sysBtnManager = new SysBtnManager(this);
        }
Exemple #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(
                        m_formBkg,
                        ClientRectangle,
                        new Rectangle(0, 0, m_formBkg.Width, m_formBkg.Height),
                        GraphicsUnit.Pixel);
                    break;

                case ImageLayout.Center:
                case ImageLayout.None:
                case ImageLayout.Tile:
                    e.Graphics.DrawImage(
                        m_formBkg,
                        ClientRectangle,
                        ClientRectangle,
                        GraphicsUnit.Pixel);
                    break;
                }
            }

            //draw system buttons
            SysBtnManager.DrawSystemButtons(e.Graphics);

            //draw fringe
            Render.DrawFormFringe(this, e.Graphics, m_formFringe, Radius);

            //draw icon
            if (Icon != null && ShowIcon)
            {
                e.Graphics.DrawIcon(Icon, IconRect);
            }

            //draw text
            if (Text.Length != 0)
            {
                if (TextWithShadow)
                {
                    using (Image textImg = Render.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);
                }
            }
        }
Exemple #5
0
 protected override void OnMouseLeave(EventArgs e)
 {
     base.OnMouseLeave(e);
     SysBtnManager.ProcessMouseOperate(Point.Empty, NuiMouseOperate.Leave);
 }
Exemple #6
0
 protected override void OnMouseMove(MouseEventArgs e)
 {
     base.OnMouseMove(e);
     SysBtnManager.ProcessMouseOperate(e.Location, NuiMouseOperate.Move);
 }