10楼#
发布于:2005-08-30 16:05
<P>木白林:把做的东西帖突出来看一下,兄弟也在做类似的事,你的有什么功能?让俺也参考一下拉</P><img src="images/post/smile/dvbbs/em04.gif" />
|
|
11楼#
发布于:2005-08-31 09:09
一个工程文件,全部帖出来很大的,你说说你是什么情况?
|
|
|
12楼#
发布于:2005-08-31 10:55
<P>我也是用activebar和ao做的系统,每个函数我都做了错误捕捉,也就是说如果发生错误,会报告哪个函数出了问题,但很多时候,例如当我一次调入多个图的时候,vb会退出,而这种错误也不是每次都有,也没有返回我的函数出错信息。就是说系统非常不稳定。我也都释放了变量,set nothing 等,还是这样。</P>
<P>能告诉我怎样解决吗?</P> |
|
|
13楼#
发布于:2005-08-31 11:38
<P>木白林:我是说把你程序界面帖出来,看看有什么菜单、功能等,我参考以下</P>
|
|
14楼#
发布于:2005-08-31 14:47
看来13楼的情况都差不多啊
|
|
|
15楼#
发布于:2005-09-12 08:52
<P>把查询窗体的代码帖出来,希望高人指点!谢谢</P>
<P> Private pMap As IMap<BR> Private pActiveView As IActiveView<BR> Private pFeatureLayer As IFeatureLayer<BR> Private pFeatureSelection As IFeatureSelection<BR> Private pQueryFilter As IQueryFilter<BR> Private pCountyEnvelope As IEnvelope<BR> Private pFeatureCursor As IFeatureCursor<BR> Private pFeature As IFeature<BR> Private pLayer As ILayer<BR> Private pFeatLayer As IFeatureLayer<BR> Private pfeacls As IFeatureClass<BR> Private pTableSort As ITableSort<BR> Private pCuror As ICursor<BR> Private pRow As IRow<BR> Private lngFieldIndex As Long<BR> <BR> </P> <P><BR>Private Sub Form_Load()<BR>'On Error GoTo Error_h</P> <P> <BR> Call getlayer(pFeatLayer)<BR> Set pfeacls = pFeatLayer.FeatureClass</P> <P> 'Dim pTableSort As ITableSort<BR> Set pTableSort = New TableSort<BR> pTableSort.Fields = "镇名"<BR> Set pTableSort.table = pFeatLayer<BR> pTableSort.Sort Nothing</P> <P> Set pCuror = pTableSort.Rows<BR> lngFieldIndex = pfeacls.FindField("镇名")<BR> Set pRow = pCuror.NextRow<BR> Do While Not pRow Is Nothing<BR> g_zm.AddItem pRow.Value(lngFieldIndex)<BR> Set pRow = pCuror.NextRow<BR> Loop</P> <P> g_xzqht.g_zm.ListIndex = 0</P> <P><BR>'Error_h:<BR>End Sub</P> <P>Private Sub Form_Unload(Cancel As Integer)</P> <P>Set g_xzqht = Nothing<BR>Set pFeatLayer = Nothing<BR>Set pfeacls = Nothing<BR>Set pLayer = Nothing<BR>Set pMap = Nothing<BR>Set pActiveView = Nothing<BR>Set pFeatureLayer = Nothing<BR>Set pQueryFilter = Nothing<BR>Set pCountyEnvelope = Nothing<BR>Set pFeatureCursor = Nothing<BR>Set pFeature = Nothing<BR>Set pFeatureSelection = Nothing<BR>Set pTableSort = Nothing<BR>Set pCuror = Nothing<BR>Set pRow = Nothing</P> <P>End Sub</P> <P><BR>Private Sub Command1_Click()<BR>'On Error GoTo Error_h</P> <P>Call SelectMapFeatureAndZoomTo("乡镇区划图", "镇名", g_zm)</P> <P>'Error_h:<BR>End Sub</P> <P>Private Sub Command2_Click()<BR>'On Error GoTo Error_h</P> <P> Dim msg As String<BR> msg = MsgBox("你真的要关闭查询窗口吗?", 4, "乡镇区划查询窗口")<BR> If msg = 6 Then<BR> g_xzqht.Hide<BR> End If<BR> <BR>'Error_h:<BR>End Sub</P> <P><BR>Public Sub SelectMapFeatureAndZoomTo(shpfile As String, fieldname As String, fieldvalue As String)<BR> 'Public Sub SelectMapFeatures()<BR> <BR> Set pMap = Form1.MapControl1.ActiveView.FocusMap<BR> <BR> Set pActiveView = pMap<BR> <BR> 'For simplicity sake let's use the first layer in the map<BR> <BR> Call getlayer(pFeatureLayer)<BR> <BR> <BR> If pFeatureLayer Is Nothing Then<BR> MsgBox "不能找到x120!"<BR> Exit Sub<BR> End If<BR> Set pFeatureSelection = pFeatureLayer 'QI<BR> <BR> 'Create the query filter<BR> Set pQueryFilter = New QueryFilter<BR> pQueryFilter.WhereClause = fieldname + " = '" + fieldvalue + "'"<BR> <BR> 'Invalidate only the selection cache<BR> 'Flag the original selection<BR> pActiveView.PartialRefresh esriViewGeoSelection, Nothing, Nothing<BR> 'Perform the selection<BR> pFeatureSelection.SelectFeatures pQueryFilter, esriSelectionResultNew, False<BR> 'Flag the new selection<BR> pActiveView.PartialRefresh esriViewGeoSelection, Nothing, Nothing<BR> <BR> <BR> Set pFeatureCursor = pFeatureLayer.Search(pQueryFilter, False)<BR> <BR> Set pFeature = pFeatureCursor.NextFeature<BR> If pFeature Is Nothing Then<BR> MsgBox fieldname + "不存在,重新选择"<BR> Else<BR> Set pCountyEnvelope = pFeature.Extent<BR> Set pActiveView = pMap<BR> pActiveView.Extent = pCountyEnvelope.Envelope<BR> pActiveView.Refresh<BR> End If<BR>End Sub</P> <P><BR>Public Sub getlayer(pFeatLayer As IFeatureLayer)<BR> 'Dim player As ILayer<BR> Dim intCount As Integer<BR> <BR> For intCount = 0 To Form1.MapControl1.LayerCount - 1<BR> Set pLayer = Form1.MapControl1.Map.Layer(intCount)<BR> If TypeOf pLayer Is IFeatureLayer Then<BR> If pLayer.Name = "乡镇区划图" Then<BR> Set pFeatLayer = pLayer<BR> Exit For<BR> End If<BR> End If<BR> Next<BR>End Sub<BR></P> |
|
|
上一页
下一页