473,320 Members | 1,831 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 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 6382
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 pages print for those pages that have not been...
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 System.IO.Stream =...
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#. The original image size is 2288 x 1712. If I...
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 control to the windows clipboard as .WMF. I am...
7
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from 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 images from a webcam and store a single frame on...
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 paste such an image from the clipboard into a "Text"...
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 = Clipboard.GetDataObject() If...
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 create a report, using the .NET Framework printing...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.