×
[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。
gdi+ で汎用エラーが発生しました
出たりだ無かったり
1.vbでPictureBoxにファイルを読み込む
Dim fs As System.IO.FileStream
fs = New System.IO.FileStream(filename _
, System.IO.FileMode.Open _
, System.IO.FileAccess.Read)
Try
PictureBox1.Image = System.Drawing.Image.FromStream(fs)
Catch argEx As ArgumentException
MsgBox(argEx.Message, MsgBoxStyle.Information)
出たりだ無かったり
1.vbでPictureBoxにファイルを読み込む
Dim fs As System.IO.FileStream
fs = New System.IO.FileStream(filename _
, System.IO.FileMode.Open _
, System.IO.FileAccess.Read)
Try
PictureBox1.Image = System.Drawing.Image.FromStream(fs)
Catch argEx As ArgumentException
MsgBox(argEx.Message, MsgBoxStyle.Information)
End Try
fs.Close()
2.またはクリップボードからはり付けで
PictureBox1.Imageを書き込むと
gdi+ で汎用エラーが発生しましたが発生する
原因は、どうもPictureBox1にロックがかかるみたい、、、、
で対応は
一端bitmapに読み込んで出力
Dim bmp As Bitmap = New Bitmap(PictureBox1.Image)
Dim fs As System.IO.FileStream = New IO.FileStream(fname, IO.FileMode.Create)
bmp.Save(fs, Imaging.ImageFormat.Jpeg)
fs.Close()
fs.Close()
2.またはクリップボードからはり付けで
PictureBox1.Imageを書き込むと
gdi+ で汎用エラーが発生しましたが発生する
原因は、どうもPictureBox1にロックがかかるみたい、、、、
で対応は
一端bitmapに読み込んで出力
Dim bmp As Bitmap = New Bitmap(PictureBox1.Image)
Dim fs As System.IO.FileStream = New IO.FileStream(fname, IO.FileMode.Create)
bmp.Save(fs, Imaging.ImageFormat.Jpeg)
fs.Close()
PR