formcaptionicon.cs

来自「破解的飞信源代码」· CS 代码 · 共 61 行

CS
61
字号
namespace Imps.Client.Pc.BizControls
{
    using System;
    using System.Drawing;
    using System.Windows.Forms;

    public class formCaptionIcon : WndlessImage
    {
        public override bool MouseClick(EventArgs e)
        {
            if ((base._menustrip != null) && base.Visible)
            {
                base._menustrip.Show(base._parent, new Point(base.Left, base.Bottom));
            }
            return true;
        }

        public override bool NcMouseDblClick(Graphics g, Point pt)
        {
            EventArgs e = new EventArgs();
            return base.RaiseDoubleClick(base._parent, e);
        }

        public override bool OnNcMouseDown(Graphics g, Point pt, MouseButtons button)
        {
            if ((button == MouseButtons.Left) && (base._menustrip != null))
            {
                base._menustrip.Show(base._parent, new Point(base.Left, 0));
            }
            return true;
        }

        public override void OnNcPaint(Graphics g, Rectangle clipRectangle)
        {
            if (base.Visible && base.NonClientArea)
            {
                if (base._image == null)
                {
                    Form form = base._parent as Form;
                    base._image = Bitmap.FromHicon(form.Icon.Handle);
                }
                base.OnPaint(g, clipRectangle);
            }
        }

        public override void OnPaint(Graphics g, Rectangle clipRectangle)
        {
            if (base.Visible && !base.NonClientArea)
            {
                if (base._image == null)
                {
                    Form form = base._parent as Form;
                    base._image = Bitmap.FromHicon(form.Icon.Handle);
                }
                base.OnPaint(g, clipRectangle);
            }
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?