Okay.. Det virker nu.. Smid et svar..
Hvis du har en god workaround på
http://support.microsoft.com/?id=814675 så må du meget gerne vise den her, for deres egen løsningsforslag kan jeg ikke få til at virke..
Til andre, koden i vb som virker:
vb______________________________
Public Shared Function Resize(ByVal b As Bitmap, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal bBilinear As Boolean) As Bitmap
Dim bTemp As Bitmap = CType(b.Clone(), Bitmap)
b = New Bitmap (nWidth, nHeight, bTemp.PixelFormat)
Dim nXFactor As Double = CType(bTemp.Width, Double) / CType(nWidth, Double)
Dim nYFactor As Double = CType(bTemp.Height, Double) / CType(nHeight, Double)
If bBilinear Then
Dim fraction_x As Double
Dim fraction_y As Double
Dim one_minus_x As Double
Dim one_minus_y As Double
Dim ceil_x As Integer
Dim ceil_y As Integer
Dim floor_x As Integer
Dim floor_y As Integer
Dim c1 As Color = New Color ()
Dim c2 As Color = New Color ()
Dim c3 As Color = New Color ()
Dim c4 As Color = New Color ()
Dim red As Byte
Dim green As Byte
Dim blue As Byte
Dim b1 As Byte
Dim b2 As Byte
Dim x As Integer = 0
While x < b.Width
Dim y As Integer = 0
While y < b.Height
floor_x = CType(Math.Floor(x * nXFactor), Integer)
floor_y = CType(Math.Floor(y * nYFactor), Integer)
ceil_x = floor_x + 1
If ceil_x >= bTemp.Width Then
ceil_x = floor_x
End If
ceil_y = floor_y + 1
If ceil_y >= bTemp.Height Then
ceil_y = floor_y
End If
fraction_x = x * nXFactor - floor_x
fraction_y = y * nYFactor - floor_y
one_minus_x = 1 - fraction_x
one_minus_y = 1 - fraction_y
c1 = bTemp.GetPixel(floor_x, floor_y)
c2 = bTemp.GetPixel(ceil_x, floor_y)
c3 = bTemp.GetPixel(floor_x, ceil_y)
c4 = bTemp.GetPixel(ceil_x, ceil_y)
b1 = CType((one_minus_x * c1.B + fraction_x * c2.B), Byte)
b2 = CType((one_minus_x * c3.B + fraction_x * c4.B), Byte)
blue = CType(one_minus_y * CType(b1, Double) + fraction_y * CType(b2, Double), Byte)
b1 = CType((one_minus_x * c1.G + fraction_x * c2.G), Byte)
b2 = CType((one_minus_x * c3.G + fraction_x * c4.G), Byte)
green = CType(one_minus_y * CType(b1, Double) + fraction_y * CType(b2, Double), Byte)
b1 = CType((one_minus_x * c1.R + fraction_x * c2.R), Byte)
b2 = CType((one_minus_x * c3.R + fraction_x * c4.R), Byte)
red = CType(one_minus_y * CType(b1, Double) + fraction_y * CType(b2, Double), Byte)
b.SetPixel(x, y, System.Drawing.Color.FromArgb(255, red, green, blue))
y = y + 1
End While
x = x + 1
End While
Else
Dim x As Integer = 0
While x < b.Width
Dim y As Integer = 0
While y < b.Height
b.SetPixel(x, y, bTemp.GetPixel(CType((Math.Floor(x * nXFactor)), Integer), CType((Math.Floor(y * nYFactor)), Integer)))
y = y + 1
End While
x = x + 1
End While
End If
Return b
End Function