Пример #1
0
 public static void InitTimer(int intervalGroup)
 {
     if (This == null)
     {
         FormAdderGlobalTimer timer = new FormAdderGlobalTimer();
         This = timer;
     }
     This.AddTimerGroup(intervalGroup);
 }
Пример #2
0
        public ImgButton2()
        {
            InitializeComponent();
            this.Controls.Add(_picture);
            _picture.BackColor             = Color.Transparent;
            _picture.BackgroundImageLayout = ImageLayout.Zoom;
            //if(_hoverTimer==null) _hoverTimer = new Timer();
            //if(_imageViewer==null) _imageViewer = new Timer();

            this.DoubleBuffered = true;
            _buttonType         = 0;
            L_Text.BackColor    = Color.Transparent;
            this.ForeColor      = L_Text.ForeColor;
            //_hoverTimer.Interval = 200;
            //_imageViewer.Interval = 1000;
            //_imageViewer.Tick += new EventHandler(_imageViewer_Tick);
            FormAdderGlobalTimer.InitTimer(200);
            FormAdderGlobalTimer.UiRefreshed += FormAdderGlobalTimer_UiRefreshed;
            base.BackColor = Color.Transparent;

            this.MouseDown  += new MouseEventHandler(ImgButton_MouseDown);
            this.MouseUp    += new MouseEventHandler(ImgButton_MouseUp);
            this.GotFocus   += new EventHandler(ImgButton_GotFocus);
            this.LostFocus  += new EventHandler(ImgButton_LostFocus);
            this.MouseEnter += ImgButton2_MouseEnter;
            this.MouseLeave += ImgButton2_MouseLeave;
            //this.MouseHover += new EventHandler(ImgButton_MouseHover);
            //this.MouseEnter +=new EventHandler(ImgButton_MouseHover);
            //this.MouseLeave += new EventHandler(ImgButton_MouseLeave);
            this.SizeChanged += new EventHandler(ImgButton_SizeChanged);
            base.Click       += new EventHandler(ImgButton_Click);

            L_Text.MouseDown += new MouseEventHandler(ImgButton_MouseDown);
            L_Text.MouseUp   += new MouseEventHandler(ImgButton_MouseUp);
            L_Text.GotFocus  += new EventHandler(ImgButton_GotFocus);
            L_Text.LostFocus += new EventHandler(ImgButton_LostFocus);
            //L_Text.MouseHover += new EventHandler(ImgButton_MouseHover);
            L_Text.Click       += new EventHandler(ImgButton_Click);
            L_Text.SizeChanged += new EventHandler(ImgButton_SizeChanged);

            _picture.MouseDown += new MouseEventHandler(ImgButton_MouseDown);
            _picture.MouseUp   += new MouseEventHandler(ImgButton_MouseUp);
            _picture.GotFocus  += new EventHandler(ImgButton_GotFocus);
            _picture.LostFocus += new EventHandler(ImgButton_LostFocus);
            //_picture.MouseHover += new EventHandler(ImgButton_MouseHover);
            //_picture.MouseLeave += new EventHandler(ImgButton_MouseLeave);
            _picture.Click += new EventHandler(ImgButton_Click);
            //L_Text.MouseLeave += new EventHandler(ImgButton_MouseLeave);

            //_imageViewer.Start();
            setTextPosition();
            this._tooltip = new ToolTip();
            this.BackgroundImageLayout = ImageLayout.Zoom;
        }