GDI+ Drawing an image on top of another

Sep 21, 2010 at 6:26 AM
I am drawing a couple of rectangles on the WinForm version of the GMap.NET control as such:
  
Public Overrides Sub OnRender(ByVal g As Graphics)
g.FillRectangle(FillBrush, New System.Drawing.Rectangle(LocalPosition.X, LocalPosition.Y, scaledWidth, scaledHeight))
End Sub
 
I then draw an image marker as such:

Public Overrides Sub OnRender(ByVal g As Graphics)
g.DrawImageUnscaled(Image, LocalPosition.X - Image.Width / 2, LocalPosition.Y - Image.Height / 2, Image.Width, Image.Height)
End Sub
 

The problem is that the image is appearing underneath the rectangle (even though the rectangle was drawn first). Is there a way to make the image appear on top of the rectangle?

Thanks

 

Coordinator
Sep 21, 2010 at 6:32 AM

you can add image marker in different layer which is added last, so it would be rendered last

Sep 21, 2010 at 6:41 AM

Of course! Hehe, thanks radioman. Worked perfectly ;)