Gets or sets the
AnnGroupObject that contains this
AnnObject.
Syntax
Example
This example creates a line, adds it to a group then adds the group to a container while checking the Container and Group property of the object.
Visual Basic | Copy Code |
---|
Public Sub AnnObject_Group()
Dim line As AnnLineObject = New AnnLineObject()
line.Name = "Line1"
ShowGroupAndContainer(line)
Dim group As AnnGroupObject = New AnnGroupObject()
group.Name = "Group1"
group.Objects.Add(line)
ShowGroupAndContainer(line)
Dim container As AnnContainer = New AnnContainer()
container.Name = "Container1"
container.Objects.Add(group)
ShowGroupAndContainer(line)
End Sub
Private Sub ShowGroupAndContainer(ByVal obj As AnnObject)
Console.Write("Container: ")
If Not obj.Container Is Nothing Then
Console.Write(obj.Container.Name)
Else
Console.Write("none")
End If
Console.Write(", Group: ")
If Not obj.Group Is Nothing Then
Console.Write(obj.Group.Name)
Else
Console.Write("none")
End If
Console.WriteLine()
End Sub |
C# | Copy Code |
---|
public void AnnObject_Group() { // add an object to the first container AnnLineObject line = new AnnLineObject(); line.Name = "Line1"; ShowGroupAndContainer(line); // add it to a group AnnGroupObject group = new AnnGroupObject(); group.Name = "Group1"; group.Objects.Add(line); ShowGroupAndContainer(line); // add the group to a container AnnContainer container = new AnnContainer(); container.Name = "Container1"; container.Objects.Add(group); ShowGroupAndContainer(line); } private void ShowGroupAndContainer(AnnObject obj) { Console.Write("Container: "); if(obj.Container != null) Console.Write(obj.Container.Name); else Console.Write("none"); Console.Write(", Group: "); if(obj.Group != null) Console.Write(obj.Group.Name); else Console.Write("none"); Console.WriteLine(); } |
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