阅读:1724回复:5
【求助】如何查找结果闪烁显示?(在线等)
<P>这个代码哪里错了?</P>
<P>Private Sub Command11_Click() Dim shp As MapObjects2.Line Dim strExpression As String Label4.Caption = "找到第" ; Si ; "个州。" '查找; strExpression = "STATE_ID = " ; Si Set recSelection = Map1.Layers(0).SearchExpression(strExpression) </P> <P>'设置闪烁2次; Set shp = recSelection.Fields("Shape").Value Map1.FlashShape shp, 2</P> <P>我用的图层是线</P> <P>调试的时候说我 Set shp = recSelection.Fields("Shape").Value类型不匹配</P> [此贴子已经被作者于2005-4-3 23:59:44编辑过]
|
|
1楼#
发布于:2005-04-04 08:40
<P>你找的结果,可能不是line,而是其他类型,所以。。。</P><P>你把 dim shp as variant 试试,看看是什么!</P>
|
|
2楼#
发布于:2005-04-04 11:36
<P>我试试</P>
|
|
3楼#
发布于:2005-04-04 11:38
<P>还是不行。这里是全部代码~~</P><P>Option Explicit
Dim g_symSelection As MapObjects2.Symbol Dim Sbl As Boolean Dim Si As Integer Dim Smax As Integer Dim recSelection As MapObjects2.Recordset Dim shp As Variant</P><P>Private Sub Command1_Click() Dim shp As MapObjects2.Line Dim strExpression As String Label1.Caption = "找到第" ; Si ; "个州。" '查找; strExpression = "STATE_ID = " ; Si Set recSelection = Map1.Layers(0).SearchExpression(strExpression) '打开显示开关; Sbl = True '设置闪烁4次; Set shp = recSelection.Fields("shape").Value Map1.FlashShape shp, 4 '调用Map1_AfterLayerDraw显示查找结果; Map1.Refresh '找到下一个州的序号; If Si < Smax Then Si = Si + 1 Else Si = 1 End If End Sub</P><P>Private Sub Form_Load() '初始设置; Sbl = False Si = 1 Label1.Caption = "点击“查找”" '添加图层; DrawLayer '设置显示模式; Set g_symSelection = New MapObjects2.Symbol With g_symSelection .SymbolType = Map1.Layers(0).Symbol.SymbolType .Color = moDarkGreen End With End Sub</P><P>Sub DrawLayer() Dim dc As New DataConnection Dim layer As MapLayer Dim recs As MapObjects2.Recordset '添加图层; dc.Database = App.Path + "\..\" + "Mexico" If Not dc.Connect Then MsgBox "在指定的文件夹下没找到图层数据文件!" End End If Set layer = New MapLayer Set layer.GeoDataset = dc.FindGeoDataset("roads") layer.Symbol.Color = moYellow Map1.Layers.Add layer '找到最大记录数; Set recs = layer.Records Smax = recs.Count End Sub</P><P>'显示查询结果; Private Sub Map1_AfterLayerDraw(ByVal index As Integer, ByVal canceled As Boolean, ByVal hDC As stdole.OLE_HANDLE) If Sbl Then If Not recSelection.EOF Then Map1.DrawShape recSelection, g_symSelection End If Set recSelection = Nothing End If End Sub</P> |
|
4楼#
发布于:2005-04-04 11:40
<P>这次他说实时错误5003“数据集里没有更多的记录”</P>
<P>there are no more records in the recordset</P> [此贴子已经被作者于2005-4-4 11:41:31编辑过]
|
|
5楼#
发布于:2005-06-03 10:02
你可以用flashshape 实现闪烁吗?
|
|