Hi again,
in .net 2003 you have to resize the image your self via code, below is an
example that resizes the image and keeps the correct proportions, it
shouldn't be to hard to modify the code so the image stretches over the
entire form ignorig the proportions. This in fact would be less code then
the sample.
Hope this helps
Greetz, Peter
Private Sub loadimage(ByVal myFileName As String)
Try
Dim imgOrg As Bitmap
Dim imgShow As Bitmap
Dim g As Graphics
Dim delenDoor, delenDoorHO, delenDoorBR As Double
'delenDoor = divide by
'delenDoorHO = divide by height
'delenDoorBR = divide by width
imgOrg = DirectCast(Bitmap.FromFile(myFileName), Bitmap)
'Get the forms' dimensions
delenDoorBR = imgOrg.Width / Me.ClientSize.Width
delenDoorHO = imgOrg.Height / Me.ClientSize.Height
If delenDoorBR > 1 Or delenDoorHO > 1 Then
If delenDoorBR > delenDoorHO Then
delenDoor = delenDoorBR
Else
delenDoor = delenDoorHO
End If
imgShow = New Bitmap(CInt(CDbl(imgOrg.Width) / delenDoor),
CInt(CDbl(imgOrg.Height) / delenDoor))
imgShow.SetResolution(imgOrg.HorizontalResolution,
imgOrg.VerticalResolution)
g = Graphics.FromImage(imgShow)
g.InterpolationMode =
Drawing2D.InterpolationMode.HighQualityBicubic
g.DrawImage(imgOrg, New Rectangle(0, 0,
CInt(CDbl(imgOrg.Width) / delenDoor), CInt(CDbl(imgOrg.Height) /
delenDoor)), 0, 0, imgOrg.Width, imgOrg.Height, GraphicsUnit.Pixel)
g.Dispose()
Else
imgShow = New Bitmap(imgOrg.Width, imgOrg.Height)
imgShow.SetResolution(imgOrg.HorizontalResolution,
imgOrg.VerticalResolution)
g = Graphics.FromImage(imgShow)
g.InterpolationMode =
Drawing2D.InterpolationMode.HighQualityBicubic
g.DrawImage(imgOrg, New Rectangle(0, 0, imgOrg.Width,
imgOrg.Height), 0, 0, imgOrg.Width, imgOrg.Height, _ GraphicsUnit.Pixel)
g.Dispose()
End If
imgOrg.Dispose()
Me.BackgroundImage = imgShow
Me.Refresh()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'pass the image file you want to load
loadimage("c:\2_1024x768.jpg")
End Sub