472,347 Members | 2,294 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,347 software developers and data experts.

Printing Window.Forms from Clipboard Image

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
2 6283
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jody Gelowitz | last post by:
I am having a problem with printing selected pages. Actually, the problem isn't with printing selected pages as it is more to do with having blank...
2
by: zbcong | last post by:
hello in my program,i have following method,it copy a jpg file to clipboard,and works well: Private Sub CopyImage() Dim file As...
0
by: P N | last post by:
Hi all, I have question about copying picture from MS-Word into the Clipboard and then copy from the Clipboard into the bitmap variable within C#. ...
3
by: Scott Friedrich | last post by:
Hi group I am using a 3rd party AX control in a VB.NET application. One of the methods of this control is to capture the current map within the...
7
by: lgbjr | last post by:
Hello All, Im using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard...
0
by: James Russo | last post by:
Hello, I have an application which requires an image to be retrived from the clipboard. So, I am writting a quick C# windows application to take...
5
by: exhuma.twn | last post by:
As many might know, windows allows to copy an image into the clipboard by pressing the "Print Screen" button on the keyboard. Is it possible to...
20
by: Joe Duchtel | last post by:
Hello - I have the following code to get a bitmap from the clipboard and to save it to a *.png file ... Dim lData As IDataObject =...
18
by: Brett | last post by:
I have an ASP.NET page that displays work orders in a GridView. In that GridView is a checkbox column. When the user clicks a "Print" button, I...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.