Edit

Share via


RefreshEventHandler Delegate

Definition

Represents the method that handles the Refreshed event raised when a Type or component is changed during design time.

C#
public delegate void RefreshEventHandler(RefreshEventArgs e);

Parameters

e
RefreshEventArgs

A RefreshEventArgs that contains the component or Type that changed.

Examples

The following sample demonstrates how to use a RefreshEventHandler delegate to handle the Refreshed event when a type or component changes. In the code, the OnRefreshed event handles the event and displays the component being changed.

The code assumes that a TextBox control is already sited on the form.

C#
private void Form1_Load(object sender, System.EventArgs e)
{
    textBox1.Text = "changed";
    System.ComponentModel.TypeDescriptor.Refreshed += new
    System.ComponentModel.RefreshEventHandler(OnRefresh);
    System.ComponentModel.TypeDescriptor.GetProperties(textBox1);
    System.ComponentModel.TypeDescriptor.Refresh(textBox1);
}

protected static void OnRefresh(System.ComponentModel.RefreshEventArgs e)
{
    Console.WriteLine(e.ComponentChanged.ToString());
}

Remarks

When you create a RefreshEventHandler delegate, you identify the method that will handle the event. To associate the event with your event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate. For more information about event handler delegates, see Handling and Raising Events.

Extension Methods

GetMethodInfo(Delegate)

Gets an object that represents the method represented by the specified delegate.

Applies to

Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0, 2.1

See also