I have a int which represents the hDC handle of my display.
How can I draw a bitmap the the display in C#? Feel free to be as broad or as specific as you want. I'm not really clear how to proceed and all advice is appreciated.
This will eventually be an ArcEngine layer interface.
public class CustomLayer : ILayer
{
public void Draw(esriDrawPhase DrawPhase, IDisplay Display, ITrackCancel TrackCancel)
{
int hdc = Display.hDC;
//how to draw a bitmap?
}
}
Graphics.FromHdc(hdc)
This gives you a nice .NET graphics object with good capability.
var graphics = Graphics.FromHdc(hdc);
// Create image.
Image newImage = Image.FromFile("Swans.bmp");
// Create Point for upper-left corner of image.
Point ulCorner = new Point(0, 0);
// Draw image to screen.
graphics.DrawImage(newImage, ulCorner);
More info here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With