Source/Editors/VisualButtonBase.cs

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

#if FRAMEWORK20
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.ComponentModel;

namespace DevComponents.Editors
{
    public class VisualButtonBase : VisualItem
    {
        #region Private Variables
        #endregion

        #region Events

        #endregion

        #region Constructor
        #endregion

        #region Internal Implementation
        private bool _ClickAutoRepeat = false;
        /// <summary>
        /// Gets or sets whether button automatically gets Click events repeated when mouse is kept pressed on the button. Default value is false.
        /// </summary>
        [DefaultValue(false)]
        public bool ClickAutoRepeat
        {
            get { return _ClickAutoRepeat; }
            set
            {
                _ClickAutoRepeat = value;
            }
        }

        private Timer _ClickTimer = null;
        protected override void OnMouseDown(MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left && this.GetIsEnabled() && _ClickAutoRepeat)
            {
                if (_ClickTimer == null)
                    _ClickTimer = new Timer();
                _ClickTimer.Interval = ClickRepeatInterval;
                _ClickTimer.Tick += new EventHandler(this.ClickTimerTick);
                _ClickTimer.Start();
            }
            base.OnMouseDown(e);
        }

        protected override void OnMouseUp(MouseEventArgs e)
        {
            if (_ClickTimer != null)
            {
                Timer t = _ClickTimer;
                _ClickTimer = null;
                t.Stop();
                t.Tick -= new EventHandler(this.ClickTimerTick);
                t.Dispose();
            }
后面还有 80 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。