找回密码
 注册
搜索
查看: 872|回复: 21

编程帮我看看

[复制链接]
发表于 2005-11-11 19:32:41 | 显示全部楼层 |阅读模式
谁帮我看看这段程序有什么基本错误...


Private Sub mnuToolsRuler_Click()
'checkedmenu.Checked = False
'pressedbutton.Value = tbrUnpressed
Set CheckedMenu = mnuToolsRuler
'Set pressedbutton = Toolbar1.Buttons(5)
CheckedMenu.Checked = True
'pressedbutton.Value = tbrPressed
Toolbar1.Refresh
  
  Map1.CurrentTool = RulerToolID
End Sub

实时错误438
对象不支持该属性或方法
发表于 2005-11-11 19:38:21 | 显示全部楼层
国考二级补考之文科生飘过.
~~~(((m-_-)m

这个报错是不是网页上经常冒出来的东西?
回复 赞 踩

使用道具 举报

发表于 2005-11-11 19:38:50 | 显示全部楼层
VB的?好像对象库里有该对象的全部可用方法查看的……进去看看吧……
回复 赞 踩

使用道具 举报

 楼主| 发表于 2005-11-11 19:46:23 | 显示全部楼层
完全不懂编程的程序员郁闷中
回复 赞 踩

使用道具 举报

发表于 2005-11-11 19:49:33 | 显示全部楼层
汗…………不懂编程又怎么会是程序员呢……?
回复 赞 踩

使用道具 举报

 楼主| 发表于 2005-11-11 19:51:37 | 显示全部楼层
因为我必须学会这东西
回复 赞 踩

使用道具 举报

发表于 2005-11-11 20:08:22 | 显示全部楼层
LH加油

国家计算机一级65分的人路过……
回复 赞 踩

使用道具 举报

发表于 2005-11-11 20:31:29 | 显示全部楼层
我学vb是为了......DIM游戏?!
回复 赞 踩

使用道具 举报

发表于 2005-11-11 20:35:32 | 显示全部楼层
Map1.CurrentTool = RulerToolID

这句我不清楚,可能错了吧
回复 赞 踩

使用道具 举报

 楼主| 发表于 2005-11-11 20:54:19 | 显示全部楼层
还没调试到那里呢
到这句CheckedMenu.Checked = True
就不知道怎么改了
回复 赞 踩

使用道具 举报

发表于 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不错了,我们还得用汇编写东西,那叫一个惨啊...
回复 赞 踩

使用道具 举报

发表于 2005-11-11 22:10:19 | 显示全部楼层
计算机2级65分的人飘过
回复 赞 踩

使用道具 举报

发表于 2005-11-11 22:19:12 | 显示全部楼层
foxhoundPLA]VB不错了,我们还得用汇编写东西,那叫一个惨啊...

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  '窗口缺省
  Begin MSComctlLib.StatusBar StatusBar1
     Align           =   2  'Align 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  'Align Top
     Height          =   690
     Left            =   0
     TabIndex        =   2
     Top             =   0
     Width           =   10920
     _ExtentX        =   19262
     _ExtentY        =   1217
     ButtonWidth     =   1085
     ButtonHeight    =   1058
     AllowCustomize  =   0   'False
     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  'True
     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   'False
        Italic          =   0   'False
        Strikethrough   =   0   'False
     EndProperty
     BeginProperty DefaultStyle.SymbolFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
        Name            =   "Map Symbols"
        Size            =   14.25
        Charset         =   2
        Weight          =   400
        Underline       =   0   'False
        Italic          =   0   'False
        Strikethrough   =   0   'False
     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   'False
     Title.Text      =   "Empty Title {01A9504B-CE13-4415-A5A0-51D8C2F15204}"
     Title.Style.TextFontBackColor=   16777215
     Title.Style.TextFontOpaque=   -1  'True
     Title.Style.SymbolChar=   0
     BeginProperty Title.Style.TextFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
        Name            =   "Arial"
        Size            =   23.25
        Charset         =   0
        Weight          =   400
        Underline       =   0   'False
        Italic          =   0   'False
        Strikethrough   =   0   'False
     EndProperty
     BeginProperty Title.Style.SymbolFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
        Name            =   "Arial"
        Size            =   23.25
        Charset         =   0
        Weight          =   400
        Underline       =   0   'False
        Italic          =   0   'False
        Strikethrough   =   0   'False
     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                 '文件名
    FilePath = cm1.FileName                  '路径名+文件名
    FilePath = Left(FilePath, InStr(FilePath, FileName) - 1)        '得到路径名
    LayerName = Left(FileName, InStr(FileName, ".") - 1)            '得到表名
'将新建图层加入到数据集
    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
  '绑定
  Set lyr = Map1.Layers.Item(1)
  Set FeaFac = Map1.FeatureFactory
  '设置点对象样式
  With newstyle
     .SymbolType = miSymbolTypeBitmap
     .SymbolBitmapSize = 24
     .SymbolBitmapTransparent = False
     .SymbolBitmapName = "YIEL2-32.BMP"
  End With
  Map1.AutoRedraw = False   '禁止自动刷新
  lyr.Editable = True      '设置当前图层为可写状态
  '创建点对象
  pnt.Set x1, y1
  '添加进当前图层
  Set ftr = FeaFac.CreateSymbol(pnt, newstyle)
  '创建符号
  Set ftr = FeaFac.CreateSymbol(pnt, Map1.DefaultStyle)
  '添加
  lyr.AddFeature ftr
  lyr.Refresh
  Map1.AutoRedraw = True
  lyr.Editable = False
  '释放
  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
  '第一个点
  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
     '累加
     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
  '多边形周长
  MsgBox DistanceValue + "  " + Me.Map1.MapUnit
  
End Sub
Private Sub Form_Load()
Map1.GeoSet = ""
'Map1.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                 '文件名
    FilePath = cm1.FileName                  '路径名+文件名
    FilePath = Left(FilePath, InStr(FilePath, FileName) - 1)        '得到路径名
    LayerName = Left(FileName, InStr(FileName, ".") - 1)            '得到表名
'将新建图层加入到数据集
    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()

'checkedmenu.Checked = False
'pressedbutton.Value = tbrUnpressed
Set checkedmenu = MNUToolsRuler
'Set pressedbutton = Toolbar1.Buttons(5)
checkedmenu.Checked = True
'pressedbutton.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
回复 赞 踩

使用道具 举报

 楼主| 发表于 2005-11-12 20:49:24 | 显示全部楼层
工程1.vbp


Type=Exe
Form=Form1.frm
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINDOWS\System32\stdole2.tlb#OLE Automation
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
IconForm="Form1"
Startup="Form1"
Command32=""
Name="工程1"
HelpContextID="0"
CompatibleMode="0"
MajorVer=1
MinorVer=0
RevisionVer=0
AutoIncrementVer=0
ServerSupportFiles=0
VersionCompanyName="8404"
CompilationType=0
OptimizationType=0
FavorPentiumPro(tm)=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=0
Unattended=0
Retained=0
ThreadPerObject=0
MaxNumberOfThreads=1
[MS Transaction Server]
AutoRefresh=1
回复 赞 踩

使用道具 举报

发表于 2005-11-12 21:08:46 | 显示全部楼层
累死,不看了
回复 赞 踩

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-11-14 07:18 , Processed in 0.041754 second(s), 5 queries , Redis On.

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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