Name

IButtonControl

Synopsis

This interface is implemented by Control objects such as Button and LinkLabel, which provide button-like behavior.

The framework requires the PerformClick() method to provide a way of programmatically clicking the button.

NotifyDefault() is called by the framework when the button becomes the default (i.e., when it is set as the active Form object’s AcceptButton).

Finally, DialogResult is the property you should implement to maintain the result code that will be set if the button is clicked to terminate a Form that has been shown modally with the ShowDialog() method.


public interface IButtonControl {

// Public Instance Properties

   public DialogResult DialogResult{set; get; }

// Public Instance Methods

   public void NotifyDefault(bool value);

   public void PerformClick();

}

Implemented By

Button, LinkLabel

Returned By

Form.{AcceptButton, CancelButton}, PrintPreviewDialog.{AcceptButton, CancelButton}

Passed To

Form.{AcceptButton, CancelButton}, PrintPreviewDialog.{AcceptButton, CancelButton}

Get .NET Windows Forms in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.