Export (0) Print
Expand All

Shape.OnRegionChanged Method

Raises the RegionChanged event.

Namespace:  Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

protected virtual void OnRegionChanged(
	EventArgs e
)

Parameters

e
Type: System.EventArgs

An EventArgs that contains the event data.

Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.

The OnRegionChanged method also enables derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

Notes to Inheritors

When you override OnRegionChanged in a derived class, be sure to call the OnRegionChanged method of the base class so that registered delegates receive the event.

The following example is an event-raising method that is executed when the Enabled property value changes. The Shape class has several methods with the name pattern OnPropertyNameChanged that raise the corresponding PropertyNameChanged event when the PropertyName value changes (PropertyName represents the name of the corresponding property.)

The following example changes the color of a line when the Enabled property of a class derived from LineShape is changed to false.

public class DisabledLine :
    LineShape
{
    protected override void OnEnabledChanged(EventArgs e)
    {
        // Change the color of the line when selected. 
        if (this.BorderColor == SystemColors.InactiveBorder)
        {
            this.BorderColor = Color.Black;
        }
        else
        {
            this.BorderColor = SystemColors.InactiveBorder;
        }
        base.OnEnabledChanged(e);
    }
}

Show:
© 2014 Microsoft