Show each pixel in the picture represent a latitude and longitude using VB6
i have a map in bitmap format.The size of picture is 1024 x 720. i need each pixel in the map represent the latitude and longitude. The latitude is from 2.85667000 to 4.01666940. The longitude is from 99.70000000 to 101.46667000. The format of latitude and longitude are decimal. Beside that, when i key in the value of latitud and longitud in text box. it can show which pixel in the picture is related to that value.
Re: Show each pixel in the picture represent a latitude and longitude using VB6
Add 2 TextBoxes (Text1, Text2), Click the Picture in the PictureBox to see pixel info printed in the Form.
VB Code:
'Prepare ScaleValues,
Private Sub Form_Load()
Me.Font.Bold = True
With Picture1
.AutoRedraw = True
.ScaleLeft = 101.46667
.ScaleWidth = 99.7 - 101.46667
.ScaleTop = 2.85667
.ScaleHeight = 4.0166694 - 2.85667
End With
End Sub
'Click the Picture and the Pixel Values in that Coordinates will be printed in the Form
Private Sub Picture1_Click()
With Picture1
Me.ForeColor = .Point(CDbl(Text1.Text), CDbl(Text2.Text))
Me.Print "COLOR: " & Me.ForeColor
End With
End Sub
'Update 2 TextBoxes with X and Y Coodinates when you move the mouse
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text1.Text = X
Text2.Text = Y
End Sub
I assume you want it as real world coordinates, with Latitude growing TOP - DOWN and Longitude growing RIGHT To LEFT.
Re: Show each pixel in the picture represent a latitude and longitude using VB6