473,654 Members | 3,084 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C#.NET windows application+pri nt a panel contents

7 New Member
my windows application form is divided into 3 split containers or split panels now what is my problem is i need to print the contents of the middle one container even if it is not seen full. but i get only the part of the panel that is visible. for example in excel sheet we can get the whole sheet content even it is in minimized condition. but at point copyFromScreen( ), i get the picture of the parts of panel theta is visible and other dialogboxes sucha a print preview dialog box and other message box active at that time how can i get only the picture of the panel even if it is not fully visible to user.

i need to print panel payment schedule.

also i m getting problem while deleting the picture. it says file is in use cana not be deleted i have to delete it how can i delete it properly so that the picture of screen can be saved next time with the same name.



Graphics myGraphics = this.panel_paym ent_schedule.Cr eateGraphics();
// MessageBox.Show ("graphics created");
Size s = this.panel_paym ent_schedule.Si ze;
Bitmap memoryImage = new Bitmap(s.Width, s.Height, myGraphics);
Graphics memoryGraphics = Graphics.FromIm age(memoryImage );
memoryGraphics. CopyFromScreen( this.panel_paym ent_schedule.Lo cation.X, this.panel_paym ent_schedule.Lo cation.Y, 0, 0, s);
if (System.IO.File .Exists(@"c:\Pr intPage.jpg"))
{
System.IO.File. Delete(@"C:\Pri ntPage.jpg");
}
memoryImage.Sav e(@"C:\PrintPag e.jpg", ImageFormat.Jpe g);


Thanks for any help
Aug 21 '08 #1
1 8660
ovi123
1 New Member
Use this instead:

if (System.IO.File .Exists(@"c:\Pr intPage.jpg"))
{
System.IO.File. Delete(@"C:\Pri ntPage.jpg");
memoryImage.Sav e(@"C:\PrintPag e.jpg", ImageFormat.Jpe g);

}else
memoryImage.Sav e(@"C:\PrintPag e.jpg", ImageFormat.Jpe g);

Accesing the harddrive is an asynchronous comunication and also is a low priority job (this means that deleting the file is not finished till the processor begin executing the instruction to overwrite it).
Apr 16 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2667
by: Konrad Koller | last post by:
Under Windows print formatting (header, footer etc.) is OK. Under LINUX it does not work. SciTEGlobal.properties state around line 352: # Printing - only works on Windows Why? How is print formatting determined under LINUX (PLAT_GTK)?
3
2863
by: PW | last post by:
I'm using the windows.print() function to print a customers receipts from an ASP. I've created a button to do it, like this ... <td align=left> <BUTTON TYPE=BUTTON onClick="window.print()">&nbsp&nbspPRINT&nbsp&nbsp</BUTTON> </td>
0
309
by: JJ | last post by:
I'm using the CrystalReportViewer1.PrintReport() method in a vb.net exe but DO NOT want the Windows Print Box to appear (I require the report to print directly)
0
1601
by: Phuff | last post by:
I need to be able to capture events thrown by the Amyuni print driver( a 3rd parter pdf conversion product), and it has specified numbers which I believe I understand to be thw wParam of the print message. here is what their documentation says: Associated with each printer event, is an event code which is given in the wParam parameter. The following event codes are defined by the Windows Device Driver Kit:
2
5176
by: newsgroper | last post by:
I set the AutoScroll property of a windows panel to true. How can I tell when the scrollbar becomes visible?
10
1955
by: nutso fasst | last post by:
Hi. Any way to do this from asp page in IIS4? Application.Contents.Remove is IIS 5+. Setting variable to empty string does not remove variable. thx, nf
0
1050
by: =?Utf-8?B?RXJpYw==?= | last post by:
Hello All, I have an Image where the corners of them are set to transparent (a=0, r=255, b=255,g=255) and I load this image as a Bitmap into the BackgroundImage property of a windows panel. When I view the panel on the screen the corners show up as the color "black". So my question is: Can the windows panel BackgroundImage property correctly intrepret portions of an image that is set to "transparent"?
5
1804
by: qhimq | last post by:
Hi, Has anyone ever heard of a program, when running, will catch all that is supposed to be printed by any program and show it on the screen, while suppressing the actual printout in the printer? If not, any ideas on how to catch all the printer's jobs, suppress them, and show them? This would save a lot of trees for future and current projects when testing the printing functions.
2
7068
by: Greg (codepug | last post by:
acCmdPrint allows me to print using the Windows Dialog. Since I want to be able to select the printer of my choice, this works well. I put his behind a button on a single form. The problem is, that instead of print the record that is being displayed, the entire table of data gets printed. How do I print just the single record being displayed, with the flexibility of Windows Dialog box that gives me the choice of printers? Thanks Greg
0
8376
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8815
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8594
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7307
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6161
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2716
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1916
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1596
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.