ThinkGeo.com    |     Documentation    |     Premium Support

Going from 8 to 10+

I have been updating from ver 8 to ver 10+ and have the following issue with this code:

System.Drawing.Rectangle ScreenRect = ExtentHelper.ToScreenCoordinate(aCanvas.CurrentWorldExtent,
this.Product.Extent, ((System.Drawing.Bitmap) aCanvas.NativeImage).Size.Width,((System.Drawing.Bitmap) aCanvas.NativeImage).Size.Height);

Issue: Cannot implicitly convert type ‘ThinkGeo.MapSuite.Shapes.DrawingRectangle’ to ‘System.Drawing.Rectangle’

I think that’s because the API “ToScreenCoordinate” has a differnet return type between the versions. I think I can add one line to convert it or build it as a function but for the life of me I’m not finding a way to do that.

Thanks.

Hi Ernest,

That is a break change from version 8.0 to 10.0. There are two ways to resolve it:

  1. Replace System.Drawing.Rectangle with ThinkGeo.MapSuite.Shapes.DrawingRectangle.
  2. Convert ThinkGeo.MapSuite.Shapes.DrawingRectangle to System.Drawing.Rectangle:
    DrawingRectangle screenDrawingRect = ExtentHelper.ToScreenCoordinate(aCanvas.CurrentWorldExtent, this.Product.Extent, ((System.Drawing.Bitmap)aCanvas.NativeImage).Size.Width, ((System.Drawing.Bitmap)aCanvas.NativeImage).Size.Height);
    Rectangle screenRect = new Rectangle(screenDrawingRect.MinimumX,screenDrawingRect.MinimumY,screenDrawingRect.Width,screenDrawingRect.Height);

If you have any questions, please feel free to contact us.

Thanks,
Rex

Thank you. That works for me!

Hi Ernest,

I am glad to hear that’s helpful.

Regards,

Ethan