Buonasera a tutti.
Chiedo aiuto a chi conosce il C#.
Dovrei convertire un pezzo di codice da VB.NET a C# correttamente.
In pratica ho già provato io, ma l'unico problema che mi rimane da risolvere si trova nella parte che vi sottolineo qui di seguito e che corrisponde all'errore:
"Impossibile convertire in modo implicito il tipo 'double' in 'int'. E' presente una conversione esplicita. Cast Mancante."
Il codice originale in VB.NET invece è il seguente:codice:double HorzSpace = 10; double VertSpace = 10; int bytes = bmpData.Stride * bmp.Height; byte[] rgbValues = new byte[bytes - 1]; byte[] HB = new byte[12641]; for (int y = 1; y <= 6; y++) { for (int x=1; x <= bmpData.Height -1; x++) { HB = new byte[(9 * bmp.Width + ((y - 1) * bmp.Height) + x) = rgbValues = new byte[((Length * x) + (4 * VertSpace * y + 1) )]]; } }
codice:Dim HorzSpace As Integer = 10 Dim VertSpace As Integer = 10 Dim bytes As Integer = bmpData.Stride * bmp.Height Dim rgbValues(bytes - 1) As Byte Dim HB(12641) As Byte For y As Integer = 1 To 6 For x As Integer = 1 To bmpData.Height - 1 HB(9 * bmp.Width + ((y - 1) * bmp.Height) + x) = rgbValues((Length * x) + (4 * VertSpace * y + 1)) Next Next
Grazie infinite.
Lucia

Rispondi quotando