Es fallo mio, o un bug?
' Me da este error y no se xq
Variable 'Claro1' is used before it has been assigned a value. A null
reference exception could result at runtime.
Dim img As New Bitmap(Me.Width, Me.Height)
Dim gr As Graphics = Graphics.FromImage(img)
Dim Blanco, Negro, Gris, Humo As Pen
Dim Claro1, Claro2, Sombra1, Sombra2 As Pen
Blanco = Pens.White
Negro = Pens.Black
Humo = Pens.WhiteSmoke
Gris = Pens.Gray
Select Case _Profundidad
Case 1
Claro1 = Humo
Sombra1 = Gris
Case 2
Claro1 = Blanco
Claro2 = Humo
Sombra1 = Negro
Sombra2 = Gris
End Select
With gr
.DrawLine(Claro1, 0, Me.Height - 1, 0, 0) <-- Linea con el error
.DrawLine(Claro1, 0, 0, Me.Width - 1, 0)
.DrawLine(Sombra1, Me.Width - 1, 1, Me.Width - 1, Me.Height - 1) <-- Linea
con el error
.DrawLine(Sombra1, Me.Width - 1, Me.Height - 1, 0, Me.Height - 1)
End With
Leer las respuestas