本文整理匯總了C#中System.Windows.Forms.IButtonControl接口的典型用法代碼示例。如果您正苦於以下問題:C# IButtonControl接口的具體用法?C# IButtonControl怎麽用?C# IButtonControl使用的例子?那麽, 這裏精選的接口代碼示例或許可以為您提供幫助。
IButtonControl接口屬於System.Windows.Forms命名空間,在下文中一共展示了IButtonControl接口的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: MyButton
//引入命名空間
using System;
using System.Windows.Forms;
using System.Drawing;
public class MyButton : ButtonBase, IButtonControl
{
private DialogResult myDialogResult;
public MyButton()
{
// Make the button White and a Popup style
// so it can be distinguished on the form.
this.FlatStyle = FlatStyle.Popup;
this.BackColor = Color.White;
}
// Add implementation to the IButtonControl.DialogResult property.
public DialogResult DialogResult
{
get
{
return this.myDialogResult;
}
set
{
if(Enum.IsDefined(typeof(DialogResult), value))
{
this.myDialogResult = value;
}
}
}
// Add implementation to the IButtonControl.NotifyDefault method.
public void NotifyDefault(bool value)
{
if(this.IsDefault != value)
{
this.IsDefault = value;
}
}
// Add implementation to the IButtonControl.PerformClick method.
public void PerformClick()
{
if(this.CanSelect)
{
this.OnClick(EventArgs.Empty);
}
}
}