csu_cheng
路人甲
路人甲
  • 注册日期2007-06-04
  • 发帖数4
  • QQ
  • 铜币116枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1732回复:3

高手请进,谁能把下面的源代码注释写详细点,谢谢

楼主#
更多 发布于:2007-06-17 00:25
<P>'The ZoomFactor sample illustrates scale-dependent<BR>'MapLayers. The application makes use of the<BR>'BeforeLayerDraw event to control which MapLayer<BR>'objects are visible.<BR>'The user should ensure the Zoom tool is selected<BR>'and drag a Rectangle on the Map. When the zoom<BR>'factor becomes smaller than 0.25, the states<BR>'MapLayer becomes invisible, and the counties<BR>'MapLayer become visible. This sample uses the<BR>'USA states And counties sample data sets.</P>
<P>Sub DoZoom(Shift As Integer)<BR>  If Shift Then    ' zoom out<BR>    Set r = Map1.Extent<BR>    r.ScaleRectangle 1.5<BR>    Map1.Extent = r<BR>  Else             ' zoom in<BR>    Set r = Map1.TrackRectangle<BR>    If Not r Is Nothing Then Map1.Extent = r<BR>  End If<BR>End Sub</P>
<P>Private Sub Form_Load()<BR>  ' load data into the map<BR>  Dim dc As New DataConnection<BR>  dc.Database = ReturnDataPath("USA")<BR>  If Not dc.Connect Then End<BR>  <BR>  Dim layer As New MapLayer<BR>  Set layer.GeoDataset = dc.FindGeoDataset("States")<BR>  layer.Symbol.Color = moPaleYellow<BR>  Map1.Layers.Add layer</P>
<P>  ' create another layer<BR>  Set layer = New MapLayer<BR>  Set layer.GeoDataset = dc.FindGeoDataset("Counties")<BR>  layer.Symbol.Color = moDarkGreen<BR>  Map1.Layers.Add layer<BR>End Sub</P>
<P>Private Sub Map1_BeforeLayerDraw(ByVal index As Integer, ByVal hDC As Stdole.OLE_HANDLE)<BR>  ' if index = 1, we're drawing the bottom layer, so<BR>  ' set the visible property of each mapLayer depending<BR>  ' on the zoom factor<BR>  If index = 1 Then<BR>    Dim zoomFactor As Double<BR>    ' zoomFactor is the ratio of the current extent<BR>    ' to the fullExtent<BR>    zoomFactor = Map1.Extent.Width / Map1.FullExtent.Width<BR>    <BR>    ' display the zoomFactor in label1<BR>    Label1.Caption = "Zoom Factor: " ; zoomFactor<BR>    <BR>    ' hide/show the mapLayers<BR>    Map1.Layers("States").Visible = zoomFactor > 0.25<BR>    Map1.Layers("Counties").Visible = zoomFactor <= 0.25<BR>  End If<BR>End Sub</P>
<P>Private Sub Map1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)<BR>  If Toolbar1.Buttons(1).Value = 1 Then<BR>    DoZoom Shift<BR>  Else<BR>    Map1.Pan<BR>  End If<BR>End Sub</P>
<P>Private Sub Toolbar1_ButtonClick(ByVal Button As Button)<BR>  If Button.index = 4 Then<BR>    Map1.Extent = Map1.FullExtent<BR>  End If<BR>End Sub</P>
<P><BR> </P>
喜欢0 评分0
wjckaxi
路人甲
路人甲
  • 注册日期2004-04-13
  • 发帖数144
  • QQ
  • 铜币149枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2007-06-20 17:54
这还不够详细吗?你把不懂的再贴出来问好了~
菜虫 欢迎光临Blog http://blog.sina.com.cn/wjckaxi
举报 回复(0) 喜欢(0)     评分
whmwxhanshan123
路人甲
路人甲
  • 注册日期2006-06-17
  • 发帖数3108
  • QQ
  • 铜币6445枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2007-06-27 14:07
<img src="images/post/smile/dvbbs/em01.gif" />
举报 回复(0) 喜欢(0)     评分
duoni
路人甲
路人甲
  • 注册日期2007-07-18
  • 发帖数6
  • QQ
  • 铜币116枚
  • 威望0点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2007-07-20 10:06
够详细了<img src="images/post/smile/dvbbs/em01.gif" />
举报 回复(0) 喜欢(0)     评分
游客

返回顶部