Помоему только так можно:
| Код | using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms;
namespace WindowsFormsApplication2 { public partial class Form1 : Form { public Form1() { InitializeComponent(); }
private void btnDraw_Click(object sender, EventArgs e) { pictureBox1.CreateGraphics().FillRectangle(Brushes.Red, 10, 10, 100, 100); pictureBox1.CreateGraphics().FillRectangle(Brushes.Green, 50, 50, 150, 150); }
private void btnSave_Click(object sender, EventArgs e) { Bitmap b = new Bitmap(pictureBox1.Width, pictureBox1.Height); Graphics g = Graphics.FromImage(b); g.CopyFromScreen(pictureBox1.PointToScreen(new Point(0, 0)), new Point(0, 0), new Size(pictureBox1.Width, pictureBox1.Height)); b.Save("c:/image.bmp"); } } }
|
|