1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| // **********************************************************************************************
private void btn_Print_Click(object sender, EventArgs e)
{
string key = "";
if (chkb_screen.Checked)
{
key = "+{PRTSC}";
}
else
{
key = "{PRTSC}";
}
SendKeys.SendWait(key);
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
PrintDialog pdd = new PrintDialog();
pdd.Document = pd;
pdd.ShowDialog();
pd.Print();
}
// **********************************************************************************************
private void pd_PrintPage(object sender, PrintPageEventArgs ev)
{
Bitmap window;
window = ((Bitmap)(Clipboard.GetDataObject().GetData("Bitmap")));
Point pos = new Point(10, 10);
ev.Graphics.DrawImage(window, pos);
ev.HasMorePages = false;
}
// ********************************************************************************************** |