56 lines
1,019 B
C#
56 lines
1,019 B
C#
using System;
|
|
using System.Windows.Forms;
|
|
using JD.Sequencers.Windowlesses;
|
|
|
|
namespace JD.Sequencers.Controls
|
|
{
|
|
public class Button : WindowlessControl
|
|
{
|
|
#region Variables
|
|
|
|
private bool m_isPressed;
|
|
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
public bool IsPressed
|
|
{
|
|
get { return m_isPressed; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Methods
|
|
|
|
protected internal override void OnMouseDown(MouseEventArgs e)
|
|
{
|
|
base.OnMouseDown(e);
|
|
|
|
m_isPressed = true;
|
|
Invalidate();
|
|
}
|
|
|
|
protected internal override void OnMouseUp(MouseEventArgs e)
|
|
{
|
|
base.OnMouseUp(e);
|
|
|
|
m_isPressed = false;
|
|
OnClick(e);
|
|
Invalidate();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Events
|
|
|
|
public event EventHandler Click;
|
|
|
|
protected virtual void OnClick(EventArgs e)
|
|
{
|
|
Click?.Invoke(this, e);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|