Hi,
When I ran this code on my machine (using a button click),
it works perfectly. Produced the bitmap and sent it to the printer on a share.
When we net load it on another machine here,
it goes to the catch block, shows no error (using innerException) and no bitmap found in the C: drive.
Anything I should look for?
try
{
Rectangle bounds = this.Bounds;
using (Bitmap bmp
= new Bitmap
(bounds
.Width, bounds
.Height)) {
using (Graphics g = Graphics.FromImage(bmp))
{
g
.CopyFromScreen(new Point
(bounds
.Left, bounds
.Top), Point
.Empty, bounds
.Size); }
bmp.Save("C://test.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
}
File.Copy("C:\\test.jpg", @"\\bcnymprtp01\NYM_Proto_Copier_Color", true);
label28.Text = "Image sent to Printer:";
label28.Refresh();
}
catch (System.Exception ex)
{
label28.Text = "Print screen Failed:";
label28.Refresh();
MessageBox.Show("\nCan't print to screen ---> " + ex.StackTrace);
}
finally
{
System.Threading.Thread.Sleep(2000);
label28.Text = "";
}