I wanted to use setpixel but somehow the picture were still all white:
Please help:
[CODE=vbnet]Public Function showparc_image( )
Dim x2 As Integer = Convert.ToInt32 (ReadLine(TextB ox2.Text, 2))
Dim y2 As Integer = Convert.ToInt32 (ReadLine(TextB ox2.Text, 1))
Dim newBitmap
Dim g
newBitmap = New Bitmap(x2, y2)
g = Graphics.FromIm age(newBitmap)
g.FillRectangle (New SolidBrush(Colo r.White), New Rectangle(0, 0, 800, 600))
newBitmap.Save( CurDir() + "\controller.bm p")
Dim type = ReadLine(TextBo x2.Text, 3)
Dim lin = 3
Dim a1
Dim a2
Dim a3
Dim a4
Dim xxa = 0
Dim yya = 0
Dim colora As Color
lp:
If ReadLine(TextBo x2.Text, lin) = "ENDOFFILE" Then
End If
a1 = Convert.ToInt32 (ReadLine(TextB ox2.Text, lin + 1))
a2 = Convert.ToInt32 (ReadLine(TextB ox2.Text, lin + 2))
a3 = Convert.ToInt32 (ReadLine(TextB ox2.Text, lin + 3))
a4 = ReadLine(TextBo x2.Text, lin + 4)
a4 = Replace(a4, "B", "") ' replace comma+space with just comma
a4 = Replace(a4, "=", "") ' replace comma+space with just comma
a4 = Convert.ToInt32 (a4)
Dim mybitmap As New Bitmap(CurDir() + "\controller.bm p")
colora = System.Drawing. Color.FromArgb( a1 + a2 + a3 + a4)
mybitmap.SetPix el(xxa, yya, colora)
If xxa = x2 - 1 Then
fn = True
xxa = 0
GoTo lp
Else
xxa = xxa + 1
End If
If yya = y2 - 1 Then
GoTo ends
Else
If fn = True Then
fn = False
yya = yya + 1
End If
End If
GoTo lp
ends:
PictureBox2.Ima geLocation = CurDir() + "\controller.bm p"
End Function[/CODE]
Please help:
[CODE=vbnet]Public Function showparc_image( )
Dim x2 As Integer = Convert.ToInt32 (ReadLine(TextB ox2.Text, 2))
Dim y2 As Integer = Convert.ToInt32 (ReadLine(TextB ox2.Text, 1))
Dim newBitmap
Dim g
newBitmap = New Bitmap(x2, y2)
g = Graphics.FromIm age(newBitmap)
g.FillRectangle (New SolidBrush(Colo r.White), New Rectangle(0, 0, 800, 600))
newBitmap.Save( CurDir() + "\controller.bm p")
Dim type = ReadLine(TextBo x2.Text, 3)
Dim lin = 3
Dim a1
Dim a2
Dim a3
Dim a4
Dim xxa = 0
Dim yya = 0
Dim colora As Color
lp:
If ReadLine(TextBo x2.Text, lin) = "ENDOFFILE" Then
End If
a1 = Convert.ToInt32 (ReadLine(TextB ox2.Text, lin + 1))
a2 = Convert.ToInt32 (ReadLine(TextB ox2.Text, lin + 2))
a3 = Convert.ToInt32 (ReadLine(TextB ox2.Text, lin + 3))
a4 = ReadLine(TextBo x2.Text, lin + 4)
a4 = Replace(a4, "B", "") ' replace comma+space with just comma
a4 = Replace(a4, "=", "") ' replace comma+space with just comma
a4 = Convert.ToInt32 (a4)
Dim mybitmap As New Bitmap(CurDir() + "\controller.bm p")
colora = System.Drawing. Color.FromArgb( a1 + a2 + a3 + a4)
mybitmap.SetPix el(xxa, yya, colora)
If xxa = x2 - 1 Then
fn = True
xxa = 0
GoTo lp
Else
xxa = xxa + 1
End If
If yya = y2 - 1 Then
GoTo ends
Else
If fn = True Then
fn = False
yya = yya + 1
End If
End If
GoTo lp
ends:
PictureBox2.Ima geLocation = CurDir() + "\controller.bm p"
End Function[/CODE]
Comment