共用方式為


Shape.Name Property

Gets or sets the name of a line or shape control.

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

Syntax

'宣告
<BrowsableAttribute(False)> _
Public Property Name As String
    Get
    Set
[BrowsableAttribute(false)]
public string Name { get; set; }
[BrowsableAttribute(false)]
public:
property String^ Name {
    String^ get ();
    void set (String^ value);
}
[<BrowsableAttribute(false)>]
member Name : string with get, set
function get Name () : String
function set Name (value : String)

Property Value

Type: System.String
The name of the control. The default is an empty string ("").

Remarks

When a line or shape control is added at design time, the name property is assigned a value that consists of the type of control plus a number. For example, the first OvalShape control added would be named "OvalShape1" and the second would be named "OvalShape2".

For line or shape controls created at run time with the New method, the Name property is an empty string ("").

Examples

The following example sets the Name property of an OvalShape control that is created by using the New method.

Dim os As New OvalShape
Dim sc As New ShapeContainer
sc.Parent = Me
os.Parent = sc
' Assign a value to the Name property.
os.Name = "NewOval1"
OvalShape os = new OvalShape();
ShapeContainer sc = new ShapeContainer();
sc.Parent = this;
os.Parent = sc;
// Assign a value to the Name property.
os.Name = "NewOval1";

.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)