参考代码
Dim lj As String = "g:\test.jpg"
Dim pan As WinForm.Panel = e.Form.Controls("me")
Dim bmp As new bitmap(pan.width, pan.height)
Dim g = graphics.fromimage(bmp)
Dim img = getimage(lj)
Dim x As Integer = (img.width - pan.width) / 2
Dim y As Integer = (img.height - pan.height) / 2
Dim w As Integer = pan.width
Dim h As Integer = pan.height
g.DrawImage(img, new Rectangle(0, 0, w, h), new Rectangle(x, y, w, h), GraphicsUnit.Pixel)
e.Form.Controls("me").BaseControl.BackgroundImage = bmp