Dim p As WinForm.Painter = e.Form.Controls("Painter1") Dim g As Graphics = p.Graphics Dim img = getImage("d:\test.jpg") If img.width > img.height Then Dim w As Integer = p.width Dim h As Integer = (p.width / img.width) * img.height g.DrawImage(img,0,0,w,h) Else Dim w As Integer = (p.height / img.height) * img.width Dim h As Integer = p.height g.DrawImage(img,0,0,w,h) End If p.Repaint
|