By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,081 Members | 1,229 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,081 IT Pros & Developers. It's quick & easy.

Printing Window.Forms from Clipboard Image

P: n/a
Hello guys,

I have a big problem with printing of windows.Forms :(

I have application with "print" button. I am trying to use
"e.Graphics.CopyFromScreen"... but in final result, over the
printing form appears other controls from the existing or new
applications in the screen ( Printing.. Please wait... - form for
example). I mean that "CopyFromScreen" getting all the forms in
defined coordinates and does not matter that the form that I want to
capture and print is bellow from "Printing.. Please wite" form -
for example.

I want to ask You:

If there any other way to do something like this:

// This happens in the main Form

Bitmap bt = new Bitmap(this);

//or

Bitmap bt = new Bitmap(Screen.FromControl(this));

Clipboard.SetImage(bt);
//Then i will get the image from the clipboard and print it....

If this is possible?
If Not, If the first variant ( using a CopyFromScreen ) have other
solutions?

Thank you in advance!!!

Jun 14 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Copy from screen does exactly what the name suggest. It takes snapshot of
the screen wahtever is currently visible.

If you your application takes snapshot of its own form you may want to try
to call form's DrawToBitmap method, but keep in mind that the best way of
doing this is to design your application in a way that it can draw itself
using arbitrary Graphics object. This way you can pass a graphics object
created out of a bitmap. DrawToBitmap uses Windows OS fetures to make a
window drawitself to a arbitrary HDC, but it doesn't work well in all of the
cases. As an example RichEdit control won't draw.
--
HTH
Stoitcho Goutsev (100)

"sitemap" <as******@gmail.com> wrote in message
news:11*********************@y41g2000cwy.googlegro ups.com...
Hello guys,

I have a big problem with printing of windows.Forms :(

I have application with "print" button. I am trying to use
"e.Graphics.CopyFromScreen"... but in final result, over the
printing form appears other controls from the existing or new
applications in the screen ( Printing.. Please wait... - form for
example). I mean that "CopyFromScreen" getting all the forms in
defined coordinates and does not matter that the form that I want to
capture and print is bellow from "Printing.. Please wite" form -
for example.

I want to ask You:

If there any other way to do something like this:

// This happens in the main Form

Bitmap bt = new Bitmap(this);

//or

Bitmap bt = new Bitmap(Screen.FromControl(this));

Clipboard.SetImage(bt);
//Then i will get the image from the clipboard and print it....

If this is possible?
If Not, If the first variant ( using a CopyFromScreen ) have other
solutions?

Thank you in advance!!!

Jun 14 '06 #2

P: n/a
Thank You!!!

I found the solution in this site:
http://www.developerfusion.co.uk/show/4630/
Stoitcho Goutsev (100) wrote:
Copy from screen does exactly what the name suggest. It takes snapshot of
the screen wahtever is currently visible.

If you your application takes snapshot of its own form you may want to try
to call form's DrawToBitmap method, but keep in mind that the best way of
doing this is to design your application in a way that it can draw itself
using arbitrary Graphics object. This way you can pass a graphics object
created out of a bitmap. DrawToBitmap uses Windows OS fetures to make a
window drawitself to a arbitrary HDC, but it doesn't work well in all of the
cases. As an example RichEdit control won't draw.
--
HTH
Stoitcho Goutsev (100)

"sitemap" <as******@gmail.com> wrote in message
news:11*********************@y41g2000cwy.googlegro ups.com...
Hello guys,

I have a big problem with printing of windows.Forms :(

I have application with "print" button. I am trying to use
"e.Graphics.CopyFromScreen"... but in final result, over the
printing form appears other controls from the existing or new
applications in the screen ( Printing.. Please wait... - form for
example). I mean that "CopyFromScreen" getting all the forms in
defined coordinates and does not matter that the form that I want to
capture and print is bellow from "Printing.. Please wite" form -
for example.

I want to ask You:

If there any other way to do something like this:

// This happens in the main Form

Bitmap bt = new Bitmap(this);

//or

Bitmap bt = new Bitmap(Screen.FromControl(this));

Clipboard.SetImage(bt);
//Then i will get the image from the clipboard and print it....

If this is possible?
If Not, If the first variant ( using a CopyFromScreen ) have other
solutions?

Thank you in advance!!!


Jun 15 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.