Exercise 8, requires that you learn to scroll the world map from the Date /Time Control Panel of Windows/Windows NT. In the current quiz, Quiz 4, you must scroll a map, starting with only a map in jpg format. The map used is a digitized version of a hand-colored engraving, originally published in 1856. It depicts the Roman Empire at its greatest extent.
Since this is the Roman Empire, center the map on Roma and choose three more points. The executable uses Gaul, Palestine, and India. When a location is selected, the map should scroll to that approximate position.
Note: the scrolling map will look odd to the modern eye since, in all settings but Roma, the tip of the Iberian Peninsula will reach to the west, wrapping around and touching India!
Map courtesy of Baldwin's Old Maps & Prints, PO Box 3515 Norfolk, Virginia 23514 (757) 625-1888.
Submit the following files:
--------------------------------------------------------------------------------------------------------------------------------
我认为这个题目的难度在于如何将事件放置好,我在刚开始的时候将redraw放在了selectchanged里面,导致每次在redraw时被一些控件覆盖了。
Public Class MainForm Private Sub redrawImage(ByVal sender As System.Object, ByVal e As Windows.Forms.PaintEventArgs) Handles MainPB.Paint Dim l As Integer Select Case Me.LocationCB.SelectedIndex Case 0 l = (160) Case 1 l = (0) Case 2 l = (220) Case 3 l = (80) End Select Dim r As Rectangle r.Y = 0 r.X = l r.Width = My.Resources.RomanEmpire.Width r.Height = My.Resources.RomanEmpire.Height e.Graphics.DrawImage(My.Resources.RomanEmpire, r) r.X = -r.Width + l e.Graphics.DrawImage(My.Resources.RomanEmpire, r) End Sub Private Sub LocationCB_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LocationCB.SelectedIndexChanged Me.MainPB.Refresh() End Sub End Class
关键点: