/// <summary> /// Method for call the delagetes /// </summary> /// <param name="e">The <see cref="LBButtonEventArgs"/> instance containing the event data.</param> protected virtual void OnButtonRepeatState(LBButtonEventArgs e) { if (this.ButtonRepeatState != null) { this.ButtonRepeatState(this, e); } }
/// <summary> /// Mouse up event /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="MouseEventArgs"/> instance containing the event data.</param> void OnMuoseUp(object sender, MouseEventArgs e) { // Change the state this.State = ButtonState.Normal; this.Invalidate(); // Call the delagates LBButtonEventArgs ev = new LBButtonEventArgs(); ev.State = this.State; this.OnButtonChangeState(ev); // Disable the timer this.tmrRepeat.Enabled = false; }
/// <summary> /// Timer event /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> void Timer_Tick(object sender, EventArgs e) { this.tmrRepeat.Enabled = false; // Update the interval if (tmrRepeat.Interval == this.startRepeatInterval) { this.tmrRepeat.Interval = this.repeatInterval; } // Call the delagate LBButtonEventArgs ev = new LBButtonEventArgs(); ev.State = this.State; this.OnButtonRepeatState(ev); this.tmrRepeat.Enabled = true; }
/// <summary> /// Mouse down event /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="MouseEventArgs"/> instance containing the event data.</param> void OnMouseDown(object sender, MouseEventArgs e) { // Change the state this.State = ButtonState.Pressed; this.Invalidate(); // Call the delagates LBButtonEventArgs ev = new LBButtonEventArgs(); ev.State = this.State; this.OnButtonChangeState(ev); // Enable the repeat timer if (this.RepeatState != false) { this.tmrRepeat.Interval = this.StartRepeatInterval; this.tmrRepeat.Enabled = true; } }