本文介绍了vb.net 2008 GDI +中发生了一般错误。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
从图片框保存图片时出错。
I am getting an error on saving images from picture box.
<br />
Public Class Form1<br />
Dim open As OpenFileDialog<br />
Dim i As String<br />
Dim img As Image = Nothing<br />
Dim pic As String<br />
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
End Sub<br />
<br />
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
open = New OpenFileDialog<br />
open.Filter = "Image Files(*.jpg;*.jpeg;*.gif;*.bmp;*.png;*.tif)|*.jpg;*.gif;*.bmp;*.tif"<br />
open.ShowDialog()<br />
pic = open.FileName<br />
Try<br />
Dim fs As New System.IO.FileStream(pic, IO.FileMode.Open, IO.FileAccess.Read)<br />
img = Image.FromStream(fs)<br />
fs.Close()<br />
fs.Dispose()<br />
emppic.Image = img<br />
Catch ex As Exception<br />
img = Nothing<br />
End Try<br />
End Sub<br />
<br />
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click<br />
Dim img6 As Image<br />
img6 = emppic.Image<br />
Try<br />
emppic.Image.Save("C:\C-tek\Images\Temp\1.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)<br />
Catch ex As Exception<br />
MsgBox("File Saving Error." + ex.ToString)<br />
End Try<br />
End Sub<br />
End Class
请提前hlp me.thnk
please hlp me.thnk in advance
推荐答案
这篇关于vb.net 2008 GDI +中发生了一般错误。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!