Device Context

  • Thread starter Thread starter ncolosi
  • Start date Start date
N

ncolosi

Is it possible to render a winform directly to a memory device context
instead of rendering to a display device context ?
 
Hi Peter, Thanks

The graphics object has a method called GetHdc() that gets a handle to the
current device context which then I can use in a win32 call to
createcompompatipledc.....

but I want to capture the form without it displaying to the physical display
if at all possible. I played around with Control.DrawToBitmap but the form is
still rendered to the physical display, I was just hoping I could change the
Device Context or something similar, whether in managed or unmanged code, so
that the Form would be rendered to a different type of device, so that the
form is captured but never seen on the display.

I went as far as to instantiate the new form call the show() method, capture
the
screen, then set the form to .visible = false; You don't see the form but
there is a
definite ugliness of seeing the screen flicker.
 
Hi Peter,

What I meant by the first statement was a nice way of saying that a Device
Context does exist in .net, and the Graphics object does encapsulate it's
functionality, that's all I meant by that scenario.

I do like your second option with WM_PAINT, though.

On MSDN documentation it says that there are 4 types of Device Contexts, 2
obvious
Display, Printer, the third being a memory DC.......
The documentation states that if you use a memory DC and have your
application write to this vs a Display DC, the output is rendered, captured
and never shows, because you by-passed the Display device. Maybe I read to
much into this, but it sounded as though there was a way to set this Device
Context so that your app renders to a device of choosing. Unfortunitley the
documentation pretty much stopped there, and not going into how to change the
default funtionality of rendering to a Display DC.

Thanks

Nick
 
Hey Peter,

Lets take this from a different angle. Lets say I have Device X, and I've
created
a device driver for device X, how do I get a .Net application to render it's
contents to Device X .VS. the default device the Display ?

Thanks

Nick
 

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