private void btnCreatePic_Click(object sender, System.EventArgs e)
{
string strPicName = "pic.jpg";
FileInfo ifExistfi = new FileInfo(strPicName);
if(ifExistfi.Exists)
ifExistfi.Delete();
int iWidth = pbxSection.Width;
        int iHeight = pbxSection.Height;
Bitmap image=new Bitmap(iWidth,iHeight); 
Graphics g=Graphics.FromImage(image); 
g.Clear(Color.White);  Pen penline=new Pen(Color.Red,5);
g.DrawLine(penline,50,50,100,200); image.Save(strPicName, System.Drawing.Imaging.ImageFormat.Jpeg);
image.Dispose();
g.Dispose();
pbxSection.Image = Image.FromFile(strPicName);
}
这样写还是不行啊