How can I delete/remove a layer and all objects on the layer.
Page 1 of 1
Deleting layers
#2
Posted 07 July 2008 - 12:29 PM
Private Sub Command1_Click()
Dim iType() As AvaxItemType
Dim iColor() As Integer
Dim iWidth() As Integer
Dim iStyle() As Integer
Dim iLayer() As Integer
Dim Elev3D() As Single
Dim Height3D() As Single
Dim h() As Long, hToDel() As Long
Dim lMax As Long
Dim lCnt As Long
Dim lCount As Long
Dim LayerToDelete As Integer
lMax = cAvax1.GetAllHandlesArr(h())
LayerToDelete = 2
If lMax > 0 Then
lCount = 0
ReDim hToDel(lMax) As Long
If cAvax1.GetAttributes(h(), iType(), iColor(), iWidth(), iStyle(), iLayer(), Elev3D(), Height3D()) = True Then
For lCnt = 1 To lMax
If iLayer(lCnt) = LayerToDelete Then
lCount = lCount + 1
hToDel(lCount) = h(lCnt)
End If
Next lCnt
End If
End If
If lCount > 0 Then
ReDim Preserve hToDel(lCount) As Long
Call cAvax1.DeleteItems(hToDel())
End If
End Sub
Private Sub Form_Load()
Command1.Caption = "remove layer 2"
Call cAvax1.StartAvax
cAvax1.Add_Rectangle 0, 0, 10, 10, , , , , 1 'Rectangle at Layer 1
cAvax1.Add_Line 0, 0, 0, 10, 10, 0, , , , , 2 'Line at Layer 2
cAvax1.Add_Line 0, 10, 0, 10, 0, 0, , , , , 2 'Line at Layer 2
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call cAvax1.EndAvax
End Sub
Athanasios Gardos
Avax-Software.com
Avax-Software.com
Page 1 of 1
Sign In
Register
Help
Add Reply

MultiQuote