IButtonControl instance for Form.AcceptButton
C#
1
Posts
1
Posters
0
Views
1
Watching
-
Hi, I want to support Esc key and Enter key for CancelButton and AcceptButton in my windows form application. I cannot directly use the buttons since they are ToolStripButton. Therefore, I have written a Wrapper like below extending the IButtonControl. The below thing works perfectly for the cancel button but not working for the AcceptButton. Please have a look and let me know if you have any idea. public struct IButtonWrapper : System.Windows.Forms.IButtonControl { public Action MyAction; #region IButtonControl Members public DialogResult DialogResult { get { return System.Windows.Forms.DialogResult.None; } set { } } public void NotifyDefault(bool value) { } public void PerformClick() { MyAction.Invoke(); } #endregion } Thank you,
CJ