Hi,
maybe this can help you, place a panel on a form and then two picturboxes in
the panel,
send the second picturebox to the back. For both pictureboxes chose dock =
fill and for
the panel anchor the top, bottom,left and right. set an image in the image
property of the second
picturebox, copy paste the code below and run the app and resize the form to
see what happens.
Don't mind about the comments in the code, they're in dutch. I know it's not
everything you asked, but it can be a start
hth Peter
<<<<<code>>>>>>
Private bmp As Bitmap
Private ptbBreedte, ptbHoogte As Integer
Private imgBr, imgHo As Integer
Private schaalH, schaalB, schaal As Double
Private Sub Form1_Resize(ByVal sender As Object, ByVal e As
System.EventArgs) _ Handles MyBase.Resize
Try
ptbBreedte = PictureBox1.Width
ptbHoogte = PictureBox1.Height
imgBr = PictureBox2.Image.Width
imgHo = PictureBox2.Image.Height
schaalH = ptbHoogte / imgHo
schaalB = ptbBreedte / imgBr
'schalen gebaseerd op wie de grootste aanpassing moet doen, de hoogte
'of de breedte, in dit geval kan de schaal niet gebaseerd worden op de
'breedte en hoogte van de image omdat de picturebox geresized kan
worden
if schaalH > schaalB Then
schaal = ptbBreedte / imgBr
Else
schaal = ptbHoogte / imgHo
End If
bmp = New Bitmap(Panel1.Width, Panel1.Height)
Dim g As Graphics = Graphics.FromImage(bmp)
g.Clear(Color.White)
g.DrawImage(PictureBox2.Image, New Rectangle(5, 5, CInt(imgBr *
schaal) - 10, _ CInt(imgHo * schaal) - 10), 0, 0, PictureBox2.Image.Width,
PictureBox2.Image.Height, GraphicsUnit.Pixel)
PictureBox1.Image = bmp
g.Dispose()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
<<<<<<<<code>>>>>>>>