how to draw image directly onto screen

  • Thread starter Thread starter myjpa1
  • Start date Start date
M

myjpa1

Hi, all,

I want to draw image directly onto top of screen, which simulates the
OSD(on screen display) effects. However, class Graphics must link to
certain controls, that cannot be used to draw at an arbitary position.
Does anyone know any approaches can perform this job?

thanks,
 
You should be able to call the GetDesktopWindow API function through
PInvoke. With that handle, you can then get the device context for the
window (through GetDC I believe). Then, you can pass that device context
handle to the static FromHdc method on the Graphics class to get a Graphics
instance to draw with.

However, you will have to be careful of refresh issues.

Hope this helps.
 
Paldino,

Thanks for your reply. I'll have a try at once:)
You should be able to call the GetDesktopWindow API function through
PInvoke. With that handle, you can then get the device context for the
window (through GetDC I believe). Then, you can pass that device context
handle to the static FromHdc method on the Graphics class to get a Graphics
instance to draw with.

However, you will have to be careful of refresh issues.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hi, all,

I want to draw image directly onto top of screen, which simulates the
OSD(on screen display) effects. However, class Graphics must link to
certain controls, that cannot be used to draw at an arbitary position.
Does anyone know any approaches can perform this job?

thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top