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);
}
这样写还是不行啊
{
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);
}
这样写还是不行啊
解决方案 »
- C#正则表达式与JS正则表达式不一样
- 已经安装了Gtk#,为什么安装monodevelop时提示Gtk# version 2.12.9 or greater must be installed……
- 如何在打开页面的服务器端得到window.open传递过来的值
- 把GridView放在了一个层里。然后放在网上。自己的电脑能看见GridView的内容。用别的电脑看不见。
- wpf的事件,有没有优先级别设置的?
- 请帮小弟看一个教材题!
- 升星,散分!
- C#连接ORACLE9I为什么出错?
- 如何取得ListBox的多个被选中项的值(WEB上使用)?
- C#程序在不同OS中的兼容性
- 如何在C#程序中取得IExplorer.exe的实际完整路径名?
- 从.dat文件里读取大量数据画图卡
“未处理的"System.IO.IOException"类型的异常出现在mscorlib.dll中。
其他信息:该进程无法访问文件"pic.jpg",因为该文件正由另一进程使用。
{
pbxSection.Image.Dispose();
pbxSection.Image = null;
}吧这两句话放在
private void btnCreatePic_Click(object sender, System.EventArgs e)
{
这个后面