タイトル : Re^4: 画像のトリミングと保存について 投稿日 : 2007/07/18(Wed) 14:37 投稿者 : ひでと
ありがとうございました。以下のように直してうまくいきました。 Private Sub PicD() Dim newGraphics As Graphics Dim bmp As Bitmap Dim l As Single Dim t As Single Dim rf As Rectangle Try bmp = New Bitmap(PictureBox2.Width, PictureBox2.Height) newGraphics = Graphics.FromImage(bmp) 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(PictureBox1.Image, 0, 0, rf, GraphicsUnit.Pixel) newGraphics.ExcludeClip(rf) PictureBox2.Image = bmp newGraphics.Dispose() Catch ex As Exception End Try End Sub |