Bitmap newImage = new Bitmap(_myForm.Width, _myForm.Height);
Rectangle rect = new Rectangle(new Point(0, 0), new Size(_myForm.Width, _myForm.Height));
Graphics g = Graphics.FromImage(newImage);
// Координаты верхнего левого угла ИСТОЧНИКА
int x0 = 10;
int y0 = 30;
// Координаты верхнего левого угла ПРИЕМНИКА
int x = 0;
int y = 0;
// Ширина и высота вырезамой части
int width = _myForm.Width - 20;
int height = _myForm.Height - 60 ;
// Image - источник
_myForm.DrawToBitmap(newImage, rect);
// Image - приемник
Bitmap img = new Bitmap(width, height);
// Область для вырезания
Rectangle srcRect = new Rectangle(x0, y0, width, height);
GraphicsUnit units = GraphicsUnit.Pixel;
// Рисуем
Graphics gr = Graphics.FromImage(img);
gr.DrawImage(newImage, x, y, srcRect, units);
img.Save(@"C:\form.png");
private void Form1_MouseUp(object sender, MouseEventArgs e)
{
isPress = false;
}
private void RightMouse(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right) this.Refresh() ;
}
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
if ((isPress) & (e.Button == MouseButtons.Left))
g.FillEllipse(new SolidBrush(Color.Black), new Rectangle(e.X, e.Y, 5, 5));
}
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
isPress = true;
if (e.Button == MouseButtons.Left)
g.FillEllipse(new SolidBrush(Color.Black), new Rectangle(e.X, e.Y, 5, 5));
else if (e.Button == MouseButtons.Right) this.Refresh();
}