找回密码
 注册
搜索
楼主: Lion_Heart

编程帮我看看

[复制链接]
发表于 2005-11-11 21:21:48 | 显示全部楼层
Menu好像没有Checked属性
发表于 2005-11-11 22:02:46 | 显示全部楼层
用C的人郁闷...路过....
发表于 2005-11-11 22:04:48 | 显示全部楼层
真想学c,可惜改不过来了
发表于 2005-11-11 22:09:53 | 显示全部楼层
梦幻のFF]真想学c,可惜改不过来了
VB不错了,我们还得用汇编写东西,那叫一个惨啃...[s:56] [s:56]
发表于 2005-11-11 22:10:19 | 显示全部楼层
计算机2级65分的人飘过
发表于 2005-11-11 22:19:12 | 显示全部楼层
foxhoundPLA]VB不错了,我们还得用汇编写东西,那叫一个惨啃...[s:56] [s:56]

ASM高手?
发表于 2005-11-11 23:24:27 | 显示全部楼层
求小岛试试吧 笑
发表于 2005-11-12 01:11:56 | 显示全部楼层
只懂一点java的人飘过
发表于 2005-11-12 11:55:11 | 显示全部楼层
大哥,光给代码没有用,控件属性什么也放七来吧……
惃vbp和frm格式的文件内容用记事本打开,复制七来,Plz
 楼主| 发表于 2005-11-12 20:48:49 | 显示全部楼层
form1.frm

VERSION 5.00
Object = "{E760686B-BC9E-4802-9ECF-175FDF4062CE}#5.0#0"; "MAPX50.DLL"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.ocx"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form Form1
  Caption      =  "Form1"
  ClientHeight   =  8310
  ClientLeft    =  165
  ClientTop     =  735
  ClientWidth    =  10920
  LinkTopic     =  "Form1"
  ScaleHeight    =  8310
  ScaleWidth    =  10920
  StartUpPosition =  3  &#39窗口缺省
  Begin MSComctlLib.StatusBar StatusBar1
    Align        =  2  &#39Align Bottom
    Height       =  375
    Left        =  0
    TabIndex      =  3
    Top         =  7935
    Width        =  10920
    _ExtentX      =  19262
    _ExtentY      =  661
    Style        =  1
    _Version      =  393216
    BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
      NumPanels     =  1
      BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
      EndProperty
    EndProperty
  End
  Begin MSComctlLib.Toolbar Toolbar1
    Align        =  1  &#39Align Top
    Height       =  690
    Left        =  0
    TabIndex      =  2
    Top         =  0
    Width        =  10920
    _ExtentX      =  19262
    _ExtentY      =  1217
    ButtonWidth    =  1085
    ButtonHeight   =  1058
    AllowCustomize  =  0  &#39False
    Appearance    =  1
    ImageList     =  "ImageList1"
    _Version      =  393216
    BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
      NumButtons    =  2
      BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
        Key         =  "new"
        ImageKey      =  "new"
        BeginProperty ButtonMenus {66833FEC-8583-11D1-B16A-00C0F0283628}
          NumButtonMenus  =  2
          BeginProperty ButtonMenu1 {66833FEE-8583-11D1-B16A-00C0F0283628}
          EndProperty
          BeginProperty ButtonMenu2 {66833FEE-8583-11D1-B16A-00C0F0283628}
          EndProperty
        EndProperty
      EndProperty
      BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
        Key         =  "car"
        ImageKey      =  "car"
      EndProperty
    EndProperty
    OLEDropMode    =  1
  End
  Begin MSComctlLib.ImageList ImageList1
    Left        =  0
    Top         =  960
    _ExtentX      =  1005
    _ExtentY      =  1005
    BackColor     =  65535
    ImageWidth    =  34
    ImageHeight    =  34
    MaskColor     =  255
    _Version      =  393216
    BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
      NumListImages  =  3
      BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
        Picture      =  "Form1.frx":0000
        Key         =  "new"
      EndProperty
      BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
        Picture      =  "Form1.frx":033A
        Key         =  "save"
      EndProperty
      BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
        Picture      =  "Form1.frx":3AD4E
        Key         =  "car"
      EndProperty
    EndProperty
  End
  Begin MSComDlg.CommonDialog cm1
    Left        =  120
    Top         =  7080
    _ExtentX      =  847
    _ExtentY      =  847
    _Version      =  393216
  End
  Begin MapXLib.Map Map1
    Height       =  6375
    Left        =  360
    TabIndex      =  1
    Top         =  960
    Width        =  9855
    _Version      =  500012
    _ExtentX      =  17383
    _ExtentY      =  11245
    _StockProps    =  1
    MapCatalog.GeoDictionary=  "GeoDictionary"
    GeoSet       =  "Empty GeosetName {9A9AC2F4-8375-44d1-BCEB-476AE986F190}"
    GeoSetUserName  =  "United States"
    DefaultStyle.TextFontBackColor=  16777215
    DefaultStyle.SupportsBitmapSymbols=  -1  &#39True
    DefaultStyle.SymbolChar=  55
    DefaultStyle.SymbolFontBackColor=  16777215
    BeginProperty DefaultStyle.TextFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
      Name        =  "Arial"
      Size        =  9.75
      Charset      =  0
      Weight       =  400
      Underline     =  0  &#39False
      Italic       =  0  &#39False
      Strikethrough  =  0  &#39False
    EndProperty
    BeginProperty DefaultStyle.SymbolFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
      Name        =  "Map Symbols"
      Size        =  14.25
      Charset      =  2
      Weight       =  400
      Underline     =  0  &#39False
      Italic       =  0  &#39False
      Strikethrough  =  0  &#39False
    EndProperty
    DefaultStyle.LineStyle=  1
    DefaultStyle.LineWidth=  1
    DefaultStyle.RegionColor=  16777215
    DefaultStyle.LinePattern=  2
    DefaultStyle.RegionBackColor=  16777215
    DefaultStyle.RegionBorderStyle=  1
    DefaultStyle.RegionBorderWidth=  1
    Title.Visible  =  0  &#39False
    Title.Text    =  "Empty Title {01A9504B-CE13-4415-A5A0-51D8C2F15204}"
    Title.Style.TextFontBackColor=  16777215
    Title.Style.TextFontOpaque=  -1  &#39True
    Title.Style.SymbolChar=  0
    BeginProperty Title.Style.TextFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
      Name        =  "Arial"
      Size        =  23.25
      Charset      =  0
      Weight       =  400
      Underline     =  0  &#39False
      Italic       =  0  &#39False
      Strikethrough  =  0  &#39False
    EndProperty
    BeginProperty Title.Style.SymbolFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
      Name        =  "Arial"
      Size        =  23.25
      Charset      =  0
      Weight       =  400
      Underline     =  0  &#39False
      Italic       =  0  &#39False
      Strikethrough  =  0  &#39False
    EndProperty
    Title.X      =  3285
    Title.Y      =  425
    Map.NumericCoordSys.ProjectionInfo=  "Form1.frx":3AFE0
    Map.DisplayCoordSys.ProjectionInfo=  "Form1.frx":3B110
  End
  Begin VB.CommandButton Command1
    Caption      =  "打开表"
    Height       =  375
    Left        =  9120
    TabIndex      =  0
    Top         =  7440
    Width        =  1095
  End
  Begin VB.Menu MNUFile
    Caption      =  "文件"
    Begin VB.Menu MNUOpenTable
      Caption      =  "打开表"
    End
    Begin VB.Menu MNUOpenProject
      Caption      =  "打开工程"
    End
  End
  Begin VB.Menu MNUEtid
    Caption      =  "编辑"
    Begin VB.Menu MNUCreatPoint
      Caption      =  "创建点对象"
    End
  End
  Begin VB.Menu MNUTool1
    Caption      =  "工具1"
    Begin VB.Menu MNUZoomin
      Caption      =  "放大"
    End
    Begin VB.Menu MNUZoomout
      Caption      =  "缩小"
    End
    Begin VB.Menu MNUPan
      Caption      =  "移动"
    End
  End
  Begin VB.Menu MNUTool2
    Caption      =  "工具2"
    Begin VB.Menu MNUDistance
      Caption      =  "量算距离"
    End
    Begin VB.Menu MNUToolsRuler
      Caption      =  "俩点间距"
    End
  End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim mousedownX1 As Double, mousedownY1 As Double
Dim x1 As Single, y1 As Single


Private Sub Command1_Click()
Dim layerinfo As New MapXLib.layerinfo
Dim lyr As MapXLib.Layer
Dim FileName As String, FilePath As String, LayerName As String

cm1.DialogTitle = "打开表"
cm1.DefaultExt = "Tab|*.tab"
cm1.Filter = "表(*.tab)|*.tab"
cm1.ShowOpen
    FileName = cm1.FileTitle            &#39文件名
    FilePath = cm1.FileName            &#39路径名+文件名
    FilePath = Left(FilePath, InStr(FilePath, FileName) - 1)      &#39得到路径名
    LayerName = Left(FileName, InStr(FileName, ".") - 1)        &#39得到表名
&#39将新建图层加入到数据集
    layerinfo.Type = miLayerInfoTypeTab
    layerinfo.AddParameter "FileSpec", FilePath + "" + FileName
    layerinfo.AddParameter "NAME", LayerName
   
    Set lyr = Map1.Layers.Add(layerinfo, 1)
   
   
   
End Sub
Private Sub Command2_Click(Index As Integer)
Case Index = 0
Map1.CurrentTool = miZoomInTool
End Sub


Private Sub Map1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Map1.CurrentTool = RulerToolID Then
   Map1.ConvertCoord X, Y, mousedownX1, mousedownY1, miScreenToMap
End If
End Sub
Private Sub Map1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Map1.CurrentTool = RulerToolID Then
   Dim x2 As Double
   Dim y2 As Double
   
   Map1.MapUnit = RulerUnit
   Map1.ConvertCoord X, Y, x2, y2, miScreenToMap
   StatusBar1.SimpleText = Map1.Distance(mousedownX1, mousedownY1, x2, y2) & "" & RulerUnitString
End If
End Sub
Private Sub MNUCreatPoint_Click()
Dim pnt As MapXLib.Point
Dim FeaFac As MapXLib.FeatureFactory
Dim lyr As MapXLib.Layer
Dim ftr As MapXLib.Feature
Dim newstyle As MapXLib.Style
  &#39绑定
  Set lyr = Map1.Layers.Item(1)
  Set FeaFac = Map1.FeatureFactory
  &#39设置点对象样式
  With newstyle
    .SymbolType = miSymbolTypeBitmap
    .SymbolBitmapSize = 24
    .SymbolBitmapTransparent = False
    .SymbolBitmapName = "YIEL2-32.BMP"
  End With
  Map1.AutoRedraw = False  &#39禁止自动刷新
  lyr.Editable = True    &#39设置当前图层为可写烶态
  &#39创建点对象
  pnt.Set x1, y1
  &#39添加进当前图层
  Set ftr = FeaFac.CreateSymbol(pnt, newstyle)
  &#39创建符号
  Set ftr = FeaFac.CreateSymbol(pnt, Map1.DefaultStyle)
  &#39添加
  lyr.AddFeature ftr
  lyr.Refresh
  Map1.AutoRedraw = True
  lyr.Editable = False
  &#39釃放
  Set pnt = Nothing
  Set FeaFac = Nothing
  Set lyr = Nothing
  Set ftr = Nothing
  
End Sub
Private Sub MNUDistance_Click()
  Dim pnt As MapXLib.Point
  Dim ftr As MapXLib.Feature
  DistanceValue = 0
  &#39第一个点
  pnt.Set ftr.Parts.Item(1).Item(1).X, ftr.Parts.Item(1).Item(1).Y
  For j = 2 To ftr.Parts.Item(1).Count
    &#39累加
    x1 = ftr.Parts.Item(1).Item(j - 1).X
    y1 = ftr.Parts.Item(1).Item(j - 1).Y
    x2 = ftr.Parts.Item(1).Item(j).X
    y2 = ftr.Parts.Item(1).Item(j).Y
    DistanceValue = diatancevalue + Me.Map1.Distance(x1, y1, x2, y2)
  Next
  &#39的边形周长
  MsgBox DistanceValue + "  " + Me.Map1.MapUnit
  
End Sub
Private Sub Form_Load()
Map1.GeoSet = ""
&#39Map1.Cureatcustomtool RulerToolID, miToolTypeLine, miSizeAllCursor
  Map1.CreateCustomTool PolyRulerToolID, miToolTypePoly, miSizeAllCursor
End Sub

Private Sub MNUOpenTable_Click()
Dim layerinfo As New MapXLib.layerinfo
Dim lyr As MapXLib.Layer
Dim FileName As String, FilePath As String, LayerName As String

cm1.DialogTitle = "打开表"
cm1.DefaultExt = "Tab|*.tab"
cm1.Filter = "表(*.tab)|*.tab"
cm1.ShowOpen
    FileName = cm1.FileTitle            &#39文件名
    FilePath = cm1.FileName            &#39路径名+文件名
    FilePath = Left(FilePath, InStr(FilePath, FileName) - 1)      &#39得到路径名
    LayerName = Left(FileName, InStr(FileName, ".") - 1)        &#39得到表名
&#39将新建图层加入到数据集
    layerinfo.Type = miLayerInfoTypeTab
    layerinfo.AddParameter "FileSpec", FilePath + "" + FileName
    layerinfo.AddParameter "NAME", LayerName
   
    Set lyr = Map1.Layers.Add(layerinfo, 1)
End Sub
Private Sub MNUToolsRuler_Click()

&#39checkedmenu.Checked = False
&#39pressedbutton.Value = tbrUnpressed
Set checkedmenu = MNUToolsRuler
&#39Set pressedbutton = Toolbar1.Buttons(5)
checkedmenu.Checked = True
&#39pressedbutton.Value = tbrPressed
Toolbar1.Refresh
  
  Map1.CurrentTool = RulerToolID
  
  
End Sub

Private Sub MNUOpenProject_Click()
cm1.DialogTitle = "打开工程"
cm1.DefaultExt = "Gst|*.gst"
cm1.Filter = "工程(*.gst)|*.gst"
cm1.ShowOpen
    FileName = cm1.FileTitle
    FilePath = cm1.FileName
    Map1.GeoSet = FilePath
   
End Sub
Private Sub MNUPan_Click()
Map1.CurrentTool = miPanTool
End Sub

Private Sub MNUZoomin_Click()
Map1.CurrentTool = miZoomInTool
End Sub
Private Sub MNUZoomout_Click()
Map1.CurrentTool = miZoomOutTool
End Sub
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|MGCN谍海游龙

GMT+8, 2026-8-18 17:44 , Processed in 0.035710 second(s), 14 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表