Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.
Become a Premium Member and unlock a new, free course in leading technologies each month.
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
'General Declaration
Dim width_ratio As Single
Dim height_ratio As Single
Private Sub Form_Load()
picMap.AutoRedraw = True
picMap.ScaleMode = 0
picMap.ScaleLeft = -180
picMap.ScaleWidth = 360
picMap.ScaleTop = 90
picMap.ScaleHeight = -180
width_ratio = picMap.Width / picMap.Height
height_ratio = picMap.Height / picMap.Width
' Draw the X axis
picMap.Line (picMap.ScaleLeft, 0)-((picMap.ScaleWidth + picMap.ScaleLeft), 0)
' Draw the Y axis
picMap.Line (0, picMap.ScaleTop)-(0, (picMap.ScaleHeight + picMap.ScaleTop))
End Sub
Private Sub Form_Resize()
If Me.Width / Me.Height < width_ratio Then
picMap.Width = Me.Width - 200
picMap.Height = picMap.Width * height_ratio
Else
picMap.Height = Me.Height - 200
picMap.Width = Me.Height * width_ratio
End If
End Sub
Dim width_ratio As Single
Dim height_ratio As Single
Private Sub Form_Load()
Me.Width = 15000
Me.Height = 7500
picMap.Left = 500
picMap.Width = Me.Width - 1000
picMap.Top = 500
picMap.Height = Me.Height - 1000
picMap.AutoRedraw = True
SetPicScaleMode
width_ratio = picMap.Width / picMap.Height
height_ratio = picMap.Height / picMap.Width
' Draw the X axis
picMap.Line (picMap.ScaleLeft, 0)-((picMap.ScaleWidth + picMap.ScaleLeft), 0)
' Draw the Y axis
picMap.Line (0, picMap.ScaleTop)-(0, (picMap.ScaleHeight + picMap.ScaleTop))
End Sub
Private Sub Form_Resize()
If Me.Width / Me.Height < width_ratio Then
picMap.Width = Me.Width - 1000
picMap.Height = picMap.Width * height_ratio
Else
picMap.Height = Me.Height - 1000
picMap.Width = picMap.Height * width_ratio
End If
' Reset the pictureboxes scales
SetPicScaleMode
' Clear the picturebox and redraw it
picMap.Cls
' Draw the X axis
picMap.Line (picMap.ScaleLeft, 0)-((picMap.ScaleWidth + picMap.ScaleLeft), 0)
' Draw the Y axis
picMap.Line (0, picMap.ScaleTop)-(0, (picMap.ScaleHeight + picMap.ScaleTop))
End Sub
Private Sub SetPicScaleMode()
picMap.ScaleMode = 0
picMap.ScaleLeft = -180
picMap.ScaleWidth = 360
picMap.ScaleTop = 90
picMap.ScaleHeight = -180
End Sub
Private Function DegreesToRadians(X As Double) As Double
Const pi = 3.14159265358979
'To convert degrees to radians, multiply degrees by pi/180.
DegreesToRadians = X * pi / 180
End Function
Private Function RadiansToDegrees(X As Double) As Double
Const pi = 3.14159265358979
'To convert radians to degrees, multiply radians by 180/pi.
RadiansToDegrees = X * (180 / pi)
End Function
Dim width_ratio As Single
Dim height_ratio As Single
Private Sub Form_Load()
Me.Width = 15000
Me.Height = 7500
picMap.Left = 500
picMap.Width = Me.Width - 1000
picMap.Top = 500
picMap.Height = Me.Height - 1000
picMap.AutoRedraw = True
SetPicScaleMode
width_ratio = picMap.Width / picMap.Height
height_ratio = picMap.Height / picMap.Width
' For latitude lines
For i = -90 To 90 Step 30 '<-- can be any step 30,15,10 for the lines
lat = DegreesToRadians(CDbl(i))
lat = Log(Tan(lat) + (1# / Cos(lat)))
lat = RadiansToDegrees(CDbl(lat))
picMap.Line (picMap.ScaleLeft, lat)-((picMap.ScaleWidth + picMap.ScaleLeft), lat)
Next i
' For longitude lines
For i = -180 To 180 Step 30 '<-- can be any step 30,15,10 for the lines
picMap.Line (i, picMap.ScaleTop)-(i, (picMap.ScaleHeight + picMap.ScaleTop))
Next i
' Draw the X axis
'picMap.Line (picMap.ScaleLeft, 0)-((picMap.ScaleWidth + picMap.ScaleLeft), 0)
' Draw the Y axis
'picMap.Line (0, picMap.ScaleTop)-(0, (picMap.ScaleHeight + picMap.ScaleTop))
End Sub
Private Sub Form_Resize()
If Me.Width / Me.Height < width_ratio Then
picMap.Width = Me.Width - 1000
picMap.Height = picMap.Width * height_ratio
Else
picMap.Height = Me.Height - 1000
picMap.Width = picMap.Height * width_ratio
End If
' Reset the pictureboxes scales
SetPicScaleMode
' Clear the picturebox and redraw it
picMap.Cls
' For latitude lines
For i = -90 To 90 Step 30 '<-- can be any step 30,15,10 for the lines
lat = DegreesToRadians(CDbl(i))
lat = Log(Tan(lat) + (1# / Cos(lat)))
lat = RadiansToDegrees(CDbl(lat))
picMap.Line (picMap.ScaleLeft, lat)-((picMap.ScaleWidth + picMap.ScaleLeft), lat)
Next i
' For longitude lines
For i = -180 To 180 Step 30 '<-- can be any step 30,15,10 for the lines
picMap.Line (i, picMap.ScaleTop)-(i, (picMap.ScaleHeight + picMap.ScaleTop))
Next i
' Draw the X axis
'picMap.Line (picMap.ScaleLeft, 0)-((picMap.ScaleWidth + picMap.ScaleLeft), 0)
' Draw the Y axis
'picMap.Line (0, picMap.ScaleTop)-(0, (picMap.ScaleHeight + picMap.ScaleTop))
End Sub
Private Sub SetPicScaleMode()
picMap.ScaleMode = 0
picMap.ScaleLeft = -180
picMap.ScaleWidth = 360
picMap.ScaleTop = 90
picMap.ScaleHeight = -180
End Sub
Private Function DegreesToRadians(X As Double) As Double
Const pi = 3.14159265358979
'To convert degrees to radians, multiply degrees by pi/180.
DegreesToRadians = X * pi / 180
End Function
Private Function RadiansToDegrees(X As Double) As Double
Const pi = 3.14159265358979
'To convert radians to degrees, multiply radians by 180/pi.
RadiansToDegrees = X * (180 / pi)
End Function
If you are experiencing a similar issue, please ask a related question
Join the community of 500,000 technology professionals and ask your questions.