📄 form03.frm
字号:
VERSION 5.00
Object = "{9BD6A640-CE75-11D1-AF04-204C4F4F5020}#2.0#0"; "mo20.ocx"
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
Begin VB.Form Form03
Caption = "华盛顿地图"
ClientHeight = 6675
ClientLeft = 1140
ClientTop = 1515
ClientWidth = 6795
LinkTopic = "Form1"
PaletteMode = 1 'UseZOrder
ScaleHeight = 6675
ScaleWidth = 6795
Begin VB.CheckBox Check1
Caption = "Check1"
Height = 375
Left = 2280
TabIndex = 1
Top = 6240
Width = 1335
End
Begin MapObjects2.Map Map1
Height = 5415
Left = 0
TabIndex = 0
Top = 120
Width = 6735
_Version = 131072
_ExtentX = 11880
_ExtentY = 9551
_StockProps = 225
BackColor = 16777215
BorderStyle = 1
WindowMode = 1
Contents = "form03.frx":0000
End
Begin VB.Label Label1
Caption = "Label1"
Height = 495
Left = 840
TabIndex = 2
Top = 5640
Width = 5775
End
Begin ComctlLib.ImageList ImageList1
Left = 2760
Top = 1800
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 8421376
_Version = 327682
BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7}
NumListImages = 3
BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = "form03.frx":001A
Key = ""
EndProperty
BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = "form03.frx":056C
Key = ""
EndProperty
BeginProperty ListImage3 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = "form03.frx":0ABE
Key = ""
EndProperty
EndProperty
End
End
Attribute VB_Name = "Form03"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Xuewei,2003/6/11,来自MO的Help;
'使用ImageLayer图层调用一个BMP图像,和MapLayer图层叠加;
'设置透明图层;
Option Explicit
Dim dataDir As String
Dim iLayer As New ImageLayer
Private Sub DrawLayer()
Dim dc As New DataConnection
Dim mLayer As New MapLayer
dc.Database = dataDir
If Not dc.Connect Then
MsgBox "在指定的文件夹下没找到图层数据文件!"
End
End If
Set mLayer.GeoDataset = dc.FindGeoDataset("roads")
mLayer.Symbol.Color = moRed
Map1.Layers.Add mLayer
iLayer.File = dataDir + "\Wash.bmp"
iLayer.Transparent = True
Map1.Layers.Add iLayer
End Sub
Private Sub Check1_Click()
If Check1.Value Then
Map1.Layers(0).Transparent = True
Map1.Refresh
Else
Map1.Layers(0).Transparent = False
Map1.Refresh
End If
End Sub
Private Sub Form_Load()
dataDir = App.Path + "\..\" + "Washington"
DrawLayer '加载图像图层;
Check1.Caption = "设置透明"
Label1.Caption = "没有设置透明颜色。"
End Sub
Private Sub Map1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim cv As Long
Dim r As Long
Dim g As Long
Dim b As Long
Dim xf As Single
Dim yf As Single
Dim Rect As New MapObjects2.Rectangle
If Button = 1 Then
xf = x + Map1.Left
yf = y + Map1.Top
cv = Point(xf, yf)
'按红、绿、蓝提取颜色;
r = cv Mod &H100
g = (cv \ &H100) Mod &H100
b = (cv \ &H10000) Mod &H100
Label1 = Str$(cv) & ": " & CDbl(r) & ", " & CDbl(g) & ", " & CDbl(b)
Map1.Layers(0).TransparentColor = cv
Map1.Refresh
ElseIf Button = 2 Then
Set Rect = Map1.TrackRectangle
Map1.Extent = Rect
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -