private void tmrRepeat_Tick(object sender, EventArgs e) { if (repeat_delay > 1) { repeat_counter++; if (repeat_counter < repeat_delay) { return; } repeat_counter = 0; repeat_delay = (repeat_delay * 3 / 4); } if (mouse_pressed == 0) { tmrRepeat.Enabled = false; } if ((mouse_pressed == 1) && top_button_rect.Contains(mouse_x, mouse_y)) { owner.UpButton(); } if ((mouse_pressed == 2) && bottom_button_rect.Contains(mouse_x, mouse_y)) { owner.DownButton(); } }
protected override void CreateHandle() { m_helper = new UpDownSpinnerHelper(); m_view = m_helper; m_helper.Host = this; m_helper.MinValue = -1; m_helper.MaxValue = 1; m_helper.IntValue = 0; m_helper.Increment = 1; m_helper.Activated += delegate(object sender, EventArgs e) { if (m_helper.IntValue == 1) { owner.UpButton(); } else if (m_helper.IntValue == -1) { owner.DownButton(); } m_helper.IntValue = 0; }; }
protected override bool ProcessDialogKey(Keys keyData) { if (parent.InterceptArrowKeys) { if ((keyData & Keys.Alt) == 0) { Keys key = keyData & Keys.KeyCode; switch (key) { case Keys.Up: parent.UpButton(); return(true); case Keys.Down: parent.DownButton(); return(true); } } } return(base.ProcessDialogKey(keyData)); }