コード例 #1
0
ファイル: DrawClass.cs プロジェクト: madmagican3/HistoryMap
 /// <summary>
 /// Draws the map at the current zoom level to the main UI
 /// </summary>
 /// <param name="user"></param>
 public DrawClass(WorldMapUser user)
 {
     //set up the rectangle based on the image size (incase we want to modify the image later)
     RenderRectangle = new Rectangle(0, 0, _localMap.Width, _localMap.Height);
     //We then draw the polygons on the map so as to allow them to zoom correctly
     _localMap = PolygonCreator.DrawBorders(Resources.maps_world_map_02, CurrentDate, Zoom);
     //Then we create a local bitmap of the image so as to have something to draw on
     _bitmap      = new Bitmap(_localMap);
     _formMapUser = user;
     //finaly we draw the map
     RenderMap();
 }
コード例 #2
0
ファイル: DrawClass.cs プロジェクト: madmagican3/HistoryMap
        public void RenderMap()
        {
            //We create a temporary rectangle for the size of the persons screen so as to create it to fit correctly
            var cropRect = new Rectangle(0, 0, _formMapUser.WorldMap.Width, _formMapUser.WorldMap.Height);

            //redraw the map with the new borders on it
            _localMap = PolygonCreator.DrawBorders(Resources.maps_world_map_02, CurrentDate, Zoom);

            using (var g = Graphics.FromImage(_bitmap))
            {
                //formMapUser draws it to the local bitmap based on the size of the screen taking it from the renderrectangle
                g.DrawImage(_localMap, cropRect, RenderRectangle, GraphicsUnit.Pixel);
                _formMapUser.WorldMap.Image = _bitmap;
            }
            var timeTuple = GetTimes(_formMapUser);

            LocalButtonCreationClass.CreateButtons(_formMapUser, this, timeTuple.Item1, timeTuple.Item2);
            _formMapUser.WorldMap.Refresh();
        }