public class GButton : System.Windows.Forms.Control, IButtonControl
{
...
private DialogResult _dlgResult;
private bool IsDefault;
...
public void NotifyDefault(bool value)
{
if (this.IsDefault != value)
{
this.IsDefault = value;
}
this.Invalidate();
}
public void PerformClick()
{
if (this.CanSelect)
{
this.OnClick(EventArgs.Empty);
}
}
...
public DialogResult DialogResult
{
get
{
return this._dlgResult;
}
set
{
if (Enum.IsDefined(typeof(DialogResult), value))
{
this._dlgResult = value;
}
}
}
...
protected override void OnClick(EventArgs e)
{
if (State == StateControls.Pushed || this.CanSelect)
base.OnClick(e);
}
}
При нажатии на форме Enter или Esc PerformClick() выполняется, но форма ни как не реагирует.