private Bitmap GenerateDragImage(PreviewModes mode) { if (mode == PreviewModes.Best) { Cursor c = Cursor; Cursor = Cursors.WaitCursor; Geometries.Point realCenter = m_Map.Center; Bitmap bmp = new Bitmap(m_Map.Size.Width * 3, m_Map.Size.Height * 3); Graphics g = Graphics.FromImage(bmp); for (int i = -1; i <= 1; i++) { for (int j = -1; j <= 1; j++) { if (i == 0 && j == 0) { g.DrawImageUnscaled(m_Image.Clone() as Image, m_Map.Size.Width, m_Map.Size.Height); } else { g.DrawImageUnscaled(GeneratePartialBitmap(realCenter, (XPosition)i, (YPosition)j), (i + 1) * m_Map.Size.Width, (j + 1) * m_Map.Size.Height); } } } g.Dispose(); m_Map.Center = realCenter; Cursor = c; return(bmp); } if (m_Image.PixelFormat != System.Drawing.Imaging.PixelFormat.Undefined) { return(m_Image.Clone() as Bitmap); } else { return(null); } }
private Bitmap GenerateDragImage(PreviewModes mode) { using (new CodeTimer("GenerateDragImage")) { if (mode == PreviewModes.Best) { Cursor c = Cursor; Cursor = Cursors.WaitCursor; SharpMap.Geometries.Point realCenter = _Map.Center; Bitmap bmp = new Bitmap(_Map.Size.Width * 3, _Map.Size.Height * 3); Graphics g = Graphics.FromImage(bmp); int i, j; for (i = -1; i <= 1; i++) { for (j = -1; j <= 1; j++) { if (i == 0 && j == 0) { g.DrawImageUnscaled(m_Image.Clone() as Image, _Map.Size.Width, _Map.Size.Height); } else { g.DrawImageUnscaled(GeneratePartialBitmap(realCenter, (XPosition)i, (YPosition)j), (i + 1) * _Map.Size.Width, (j + 1) * _Map.Size.Height); } } } g.Dispose(); _Map.Center = realCenter; Cursor = c; return(bmp); } else { return(m_Image.Clone() as Bitmap); } } }
private Bitmap GenerateDragImage(PreviewModes mode) { if (mode == PreviewModes.Best) { Cursor c = Cursor; Cursor = Cursors.WaitCursor; GeoPoint realCenter = _map.Center; Bitmap bmp = new Bitmap(_map.Size.Width * 3, _map.Size.Height * 3); Graphics g = Graphics.FromImage(bmp); for (int i = -1; i <= 1; i++) { for (int j = -1; j <= 1; j++) { if (i == 0 && j == 0) { var clone = _image.Clone() as Image; if (clone != null) g.DrawImageUnscaled(clone, _map.Size.Width, _map.Size.Height); } else g.DrawImageUnscaled(GeneratePartialBitmap(realCenter, (XPosition)i, (YPosition)j), (i + 1) * _map.Size.Width, (j + 1) * _map.Size.Height); } } g.Dispose(); _map.Center = realCenter; Cursor = c; return bmp; } if (_image.PixelFormat != PixelFormat.Undefined) return _image.Clone() as Bitmap; return null; }
private Bitmap GenerateDragImage(PreviewModes mode) { if (mode == PreviewModes.Best) { Cursor c = Cursor; Cursor = Cursors.WaitCursor; SharpMap.Geometries.Point realCenter = m_Map.Center; Bitmap bmp = new Bitmap(m_Map.Size.Width * 3, m_Map.Size.Height * 3); Graphics g = Graphics.FromImage(bmp); int i, j; for (i = -1; i <= 1; i++) { for (j = -1; j <= 1; j++) { if (i == 0 && j == 0) g.DrawImageUnscaled(m_Image.Clone() as Image, m_Map.Size.Width, m_Map.Size.Height); else g.DrawImageUnscaled(GeneratePartialBitmap(realCenter, (XPosition)i, (YPosition)j), (i + 1) * m_Map.Size.Width, (j + 1) * m_Map.Size.Height); } } g.Dispose(); m_Map.Center = realCenter; Cursor = c; return bmp; } else return m_Image.Clone() as Bitmap; }