Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

SimpleShape.OnClientSizeChanged Method

Raises the ClientSizeChanged event.

Namespace:  Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)
protected virtual void OnClientSizeChanged(
	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 OnClientSizeChanged 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 overriding OnClientSizeChanged in a derived class, be sure to call the OnClientSizeChanged method of the base class so that registered delegates receive the event.

The following example is a method that is executed when the Click event occurs. The Shape class has several methods that have the name pattern OnEventName that execute methods when the EventName event occurs. (EventName represents the name of the corresponding event.)

The following example demonstrates how to override the OnClick and OnLostFocus methods in a class that derives from LineShape.

public class HighlightLine :
    LineShape
{
    protected override void OnClick(EventArgs e)
    {
        // Change the color of the line when clicked. 
        this.BorderColor = Color.Red;
        base.OnClick(e);
    }
    protected override void OnLostFocus(System.EventArgs e)
    {
        // Change the color of the line when focus is changed. 
        this.BorderColor = Color.Black;
        base.OnLostFocus(e);
    }
}
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.