Hello Community,
I was wondering if there is a way to get only the visible section of the image from picturebox1 and place it in picturebox2.

So what I have is picturebox1 set to a certain size, and the image size mode is set to center. Picturebox2 is also set to a certain size but the size mode is set to sketch. In the example I've attached the dash line represents the border of picturebox1. So what is on the inside is what I want moved to the second picturebox. Note all the images in going in picturebox1, most of them won't be the same size.

Attachments Example.png 81.74 KB
4 Years
Discussion Span
Last Post by joshl_1995

Maybe this is what you want?

Dim x As Integer = PictureBox1.Width
        Dim y As Integer = PictureBox1.Height
        Dim bm As New Bitmap(x, y)

        PictureBox1.DrawToBitmap(bm, New Rectangle(0, 0, x, y))

        PictureBox2.Image = bm
Attachments 2.jpg 29.74 KB
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.