' //Deletes all features selected on the current layer
    Public Sub DeleteAllSelectedFeatures(ByVal pFeatureCursor As IFeatureCursor, ByVal GeometryTypeStr As String)
        Dim pWorkspaceEdit As IWorkspaceEdit
        Dim pFeature As IFeature
        ' If there are no features currently selected then nothing to do
        If pFeatureCursor Is Nothing Then Exit Sub
        Try
            Dim bResponse As DialogResult
            bResponse = MsgBox("您确定删除所有" & GeometryTypeStr & "要素吗?", MessageBoxButtons.YesNo)
            If bResponse = Windows.Forms.DialogResult.Yes Then
                ' Loop over the selected features deleting each in turn
                pWorkspaceEdit = pSdeWorkspace
                pWorkspaceEdit.StartEditing(True)
                pWorkspaceEdit.StartEditOperation()
                pFeature = pFeatureCursor.NextFeature
                While Not pFeature Is Nothing
                    pFeature.Delete()
                    pFeature = pFeatureCursor.NextFeature
                End While
                pWorkspaceEdit.StopEditOperation()
                pWorkspaceEdit.StopEditing(True)
            End If
            mainForm1.AxMapControl1.ActiveView.Refresh()
            Exit Sub
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
    End Sub

相关文章:

  • 2021-11-30
  • 2021-12-29
  • 2021-05-13
  • 2021-06-07
  • 2022-12-23
  • 2022-12-23
  • 2021-07-28
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案