共用方式為


Shape.ParentChanged Event

Occurs when the Parent property value changes.

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

Syntax

'宣告
<BrowsableAttribute(True)> _
Public Event ParentChanged As EventHandler
[BrowsableAttribute(true)]
public event EventHandler ParentChanged
[BrowsableAttribute(true)]
public:
 event EventHandler^ ParentChanged {
    void add (EventHandler^ value);
    void remove (EventHandler^ value);
}
[<BrowsableAttribute(true)>]
member ParentChanged : IEvent<EventHandler,
    EventArgs>
JScript does not support events.

Remarks

The Parent property must be set to an instance of a ShapeContainer.

For more information about how to handle events, see Consuming Events.

Examples

The following example shows how to respond to the ParentChanged event in an event handler. This example requires that you have an OvalShape control named OvalShape1 on a form.

Private Sub OvalShape1_ParentChanged() Handles OvalShape1.ParentChanged
    MsgBox("The shape has been moved to a new container.")
End Sub
private void ovalShape1_ParentChanged(object sender, System.EventArgs e)
{
    MessageBox.Show("The shape has been moved to a new container.");
}

.NET Framework Security

See Also

Reference

Shape Class

Microsoft.VisualBasic.PowerPacks Namespace

Other Resources

How to: Draw Lines with the LineShape Control (Visual Studio)

How to: Draw Shapes with the OvalShape and RectangleShape Controls (Visual Studio)

Introduction to the Line and Shape Controls (Visual Studio)