Brian,
Could you try to override DrawScreenImageWithoutScalingCore method in GdiPlusGeoCanvas? Here are the sample code you can refer to:
public class CustomGdiPlusGeoCanvas : GdiPlusGeoCanvas
{
Bitmap canvasBitmap;
protected override void BeginDrawingCore(object nativeImage, RectangleShape worldExtent, GeographyUnit drawingMapUnit)
{
canvasBitmap = nativeImage as Bitmap;
base.BeginDrawingCore(nativeImage, worldExtent, drawingMapUnit);
}
protected override void DrawScreenImageWithoutScalingCore(GeoImage image, float centerXInScreen, float centerYInScreen, DrawingLevel drawingLevel, float xOffset, float yOffset, float rotateAngle)
{
Bitmap bitmap;
lock (image)
{
bitmap = new Bitmap(image.GetImageStream(this));
}
bitmap.SetResolution(Dpi, Dpi);
int imageWidth = bitmap.Width;
int imageHeight = bitmap.Height;
float screenX = centerXInScreen;
float screenY = centerYInScreen;
screenX += -imageWidth / 2.0f + xOffset;
screenY += -imageHeight / 2.0f + yOffset;
if (rotateAngle == 0)
{
try
{
Graphics graphics = Graphics.FromImage(canvasBitmap);
graphics.DrawImageUnscaled(bitmap, (int)Math.Round(screenX), (int)Math.Round(screenY));
}
finally
{
if (bitmap != null) { bitmap.Dispose(); }
}
}
else
{
float upperLeftPointX = -imageWidth * 0.5f;
float upperLeftPointY = imageHeight * 0.5f;
double rotateRadient = rotateAngle * Math.PI / 180;
double baseRadient = Math.PI - Math.Atan((double)imageHeight / (double)imageWidth);
double radius = Math.Sqrt(imageWidth * imageWidth + imageHeight * imageHeight) * 0.5;
double newRadient = baseRadient + rotateRadient;
double newPointX = radius * Math.Cos(newRadient);
double newPointY = radius * Math.Sin(newRadient);
double xOffsetInScreen = newPointX - upperLeftPointX;
double yOffsetInScreen = -(newPointY - upperLeftPointY);
screenX += (float)xOffsetInScreen;
screenY += (float)yOffsetInScreen;
try
{
Graphics graphics = Graphics.FromImage(canvasBitmap);
graphics.TranslateTransform(screenX, screenY);
graphics.RotateTransform(-rotateAngle);
graphics.DrawImageUnscaled(bitmap, 0, 0);
graphics.RotateTransform(rotateAngle);
graphics.TranslateTransform(-screenX, -screenY);
}
finally
{
if (bitmap != null) { bitmap.Dispose(); }
}
}
}
}
If you still could make it, I have no other ways.
Sorry for inconvenience.
James