, Visual C#


         

,


OffOn = false;
}
}
, ( ).
59.6. PrintDocument.
private void printDocument1_PrintPage(object sender,
System.Drawing.Printing.PrintPageEventArgs e)
{
// myGraphics Graphics:
Graphics myGraphics = CreateGraphics();
// myGraphics :
myGraphics = e.Graphics;

// ,
// :
myGraphics.DrawLine(new Pen(Color.Red, 3),
boundary_of_rectangle_x, boundary_of_rectangle_,
width_of_rectangle, boundary_of_rectangle_);
myGraphics.DrawLine(new Pen(Color.Red, 3),
boundary_of_rectangle_x, boundary_of_rectangle_,
boundary_of_rectangle_x, height_of_rectangle);
myGraphics.DrawLine(new Pen(Color.Red, 3),
boundary_of_rectangle_x, height_of_rectangle,
width_of_rectangle, height_of_rectangle);
myGraphics.DrawLine(new Pen(Color.Red, 3),
width_of_rectangle, boundary_of_rectangle_,
width_of_rectangle, height_of_rectangle);
// Form1
// DrawImage:
myGraphics.DrawImage(myBitmap,
Convert.ToInt32(position_of_ball_x -
width_of_bitmap_of_ball / 2),
Convert.ToInt32(position_of_ball_y -
height_of_bitmap_of_ball / 2),
width_of_bitmap_of_ball,
height_of_bitmap_of_ball);

// , myGraphics:
myGraphics.Dispose();
}
Print (. 59.1). Form1.cs , .
59.7. Print.
private void button3_Click(object sender, EventArgs e)
{
// PrintDialog1
//PrintDocument1 Document:
printDialog1.Document = printDocument1;
// Print
//ShowDialog :
if (printDialog1.ShowDialog() == DialogResult.OK)
printDocument1.Print();
}
, ( , , ..), .