Gets or sets the
AnnContainer that contains this
AnnObject.
Syntax
Visual Basic (Declaration) | |
---|
Public Overridable Property Container As AnnContainer |
Visual Basic (Usage) | Copy Code |
---|
Dim instance As AnnObject
Dim value As AnnContainer
instance.Container = value
value = instance.Container
|
Managed Extensions for C++ | |
---|
public: __property virtual AnnContainer* get_Container();
public: __property virtual void set_Container(
AnnContainer* value
); |
Return Value
The
AnnContainer that contains this
AnnObject.
Example
This example creates two containers, adds an object to the first container then moves it to the second while checking the Container property of the object.
Visual Basic | Copy Code |
---|
Public Sub AnnObject_Container()
Dim firstContainer As AnnContainer = New AnnContainer()
firstContainer.Name = "First Container"
Dim secondContainer As AnnContainer = New AnnContainer()
secondContainer.Name = "Second Container"
Dim line As AnnLineObject = New AnnLineObject()
line.Name = "Line1"
firstContainer.Objects.Add(line)
Dim s As String = String.Format("Container: {0}", line.Container.Name)
MessageBox.Show(s)
firstContainer.Objects.Remove(line)
secondContainer.Objects.Add(line)
s = String.Format("Container: {0}", line.Container.Name)
MessageBox.Show(s)
End Sub |
C# | Copy Code |
---|
public void AnnObject_Container() { // create 2 containers AnnContainer firstContainer = new AnnContainer(); firstContainer.Name = "First Container"; AnnContainer secondContainer = new AnnContainer(); secondContainer.Name = "Second Container"; // add an object to the first container AnnLineObject line = new AnnLineObject(); line.Name = "Line1"; // add the object to the first container firstContainer.Objects.Add(line); string s = string.Format("Container: {0}", line.Container.Name); MessageBox.Show(s); // move the object to the second container firstContainer.Objects.Remove(line); secondContainer.Objects.Add(line); s = string.Format("Container: {0}", line.Container.Name); MessageBox.Show(s); } |
Remarks
Requirements
Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also