【文件属性】:
文件名称:windows C#窗口闪烁的代码
文件大小:2KB
文件格式:TXT
更新时间:2012-07-04 15:43:16
C#
'''
''' Element的方式闪烁图元
'''
''' 选中图元的geometry
''' 选中图元的geometry类型
''' 该方式就是先加一个element,然后再将之删除,这种方法经过扩展,还可以用于三维闪烁
Sub FlashGeoByElement(ByVal pActiveView As IActiveView, ByVal pGeo As IGeometry, ByVal pGeoType As esriGeometryType)
Dim pElement As IElement = Nothing
Dim pColor As IColor = New RgbColor
pColor.RGB = RGB(255, 0, 0)
Select Case pGeoType
Case esriGeometryType.esriGeometryPoint
Dim pMarSymbol As IMarkerSymbol = New SimpleMarkerSymbol
pMarSymbol.Color = pColor
pMarSymbol.Size = 10
pElement = New MarkerElement
pElement.Geometry = pGeo
CType(pElement, IMarkerElement).Symbol = pMarSymbol
Case esriGeometryType.esriGeometryPolyline
Dim pLineSymbol As ISimpleLineSymbol = New SimpleLineSymbol
pLineSymbol.Color = pColor
pLineSymbol.Width = 3
pElement = New LineElement
pElement.Geometry = pGeo
CType(pElement, ILineElement).Symbol = pLineSymbol
Case esriGeometryType.esriGeometryPolygon
Dim pSimpleFillSymbol As IFillSymbol = New SimpleFillSymbol
pSimpleFillSymbol.Outline.Width = 0
pSimpleFillSymbol.Color = pColor
pElement = New PolygonElement
pElement.Geometry = pGeo
CType(pElement, IFillShapeElement).Symbol = pSimpleFillSymbol
End Select
Dim pG As IGraphicsContainer = pActiveView
If pElement IsNot Nothing Then
pG.AddElement(pElement, 0)
pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, Nothing, Nothing)
pActiveView.ScreenDisplay.UpdateWindow()
System.Threading.Thread.Sleep(300)
pG.DeleteElement(pElement)
pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, Nothing, Nothing)
End If
End Sub