タイトル : 画像のトリミングと保存について 投稿日 : 2007/07/17(Tue) 16:23 投稿者 : ひでと
お世話になります。 PictureBox1とPictureBox2を使い、PictureBox1には画像をAutoSizeにして取り込み PictureBox2にその一部を表示しようとしています。表示は出来たのですが、それを保存 するためには、PictureBox2のImageプロパティに画像を反映しなければならないようです。 GraphicsクラスのDrawImageを使用していますが、Imageプロパティの設定ができません。 どのようにすればよいのでしょうか。よろしくお願いします。 Private Sub PicD() Dim newGraphics As Graphics Dim newImage As Image Dim l As Single Dim t As Single Dim rf As Rectangle Try newImage = PictureBox1.Image newGraphics = PictureBox2.CreateGraphics l = PictureBox2.Left - PictureBox1.Left t = PictureBox2.Top - PictureBox1.Top rf.X = l rf.Y = t rf.Width = PictureBox2.Width rf.Height = PictureBox2.Height newGraphics.DrawImage(newImage, 0, 0, rf, GraphicsUnit.Pixel) Catch ex As Exception End Try End Sub |