C# School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a C# Expert!

Join 308,428 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 3,219 people online right now. Registration is fast and FREE... Join Now!




How to take a print of window form ?

 

How to take a print of window form ?

avani@swayamsoftware.com

1 Jul, 2009 - 02:25 AM
Post #1

D.I.C Head
**

Joined: 2 Jun, 2009
Posts: 51



Thanked: 1 times
My Contributions
Hi there,

I want to take a print of my window form which created in c# .net.

Actually instead of using crystal report i m using a window form to print data as a report formate.

Now i want to take a print of this window form. So, If any one have idea how to do this then please help me.

User is offlineProfile CardPM
+Quote Post


RudiVisser

RE: How To Take A Print Of Window Form ?

1 Jul, 2009 - 03:37 AM
Post #2

.. does not guess solutions
Group Icon

Joined: 5 Jun, 2009
Posts: 1,891



Thanked: 139 times
Dream Kudos: 125
Expert In: PHP, MySQL, HTML, CSS, C#

My Contributions
Look into Graphics.CopyFromScreen.
User is offlineProfile CardPM
+Quote Post

PsychoCoder

RE: How To Take A Print Of Window Form ?

1 Jul, 2009 - 07:12 AM
Post #3

I Code, Therefore I am
Group Icon

Joined: 26 Jul, 2007
Posts: 15,001



Thanked: 522 times
Dream Kudos: 11700
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net, jQuery

My Contributions
Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Post your code like this: code.gif

Thanks.
User is offlineProfile CardPM
+Quote Post

b.ihde

RE: How To Take A Print Of Window Form ?

1 Jul, 2009 - 07:31 AM
Post #4

D.I.C for life
Group Icon

Joined: 29 Sep, 2008
Posts: 979



Thanked: 30 times
Dream Kudos: 75
My Contributions
Didnīt we have a snippet for that?? I thought i saw something like that..

But couldnīt find it in a quick look through the snippets..

Ben
User is offlineProfile CardPM
+Quote Post

RudiVisser

RE: How To Take A Print Of Window Form ?

1 Jul, 2009 - 07:48 AM
Post #5

.. does not guess solutions
Group Icon

Joined: 5 Jun, 2009
Posts: 1,891



Thanked: 139 times
Dream Kudos: 125
Expert In: PHP, MySQL, HTML, CSS, C#

My Contributions
There's no need for that, it's possibly the simplest thing to do ever.

CODE
Bitmap b = new Bitmap(this.Width, this.Height);
            Graphics g = Graphics.FromImage(b);
            g.CopyFromScreen(this.Location.X, this.Location.Y, 0, 0, this.Size);
            b.Save("test.jpg");
            g.Dispose();
            b.Dispose();


Tested, works fine.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/24/09 01:47PM

Live C# Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

C# Tutorials

Reference Sheets

C# Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month