怎么在PictureBox上的某一个位置绘制1像素?
vb.net吧
全部回复
仅看楼主
level 9
我有一个字符串,记录了一张图的每个像素的argb。我想用循环在图上逐像素打出颜色,怎么做?
2017年10月18日 12点10分 1
level 9
For Me.ct = 0 To orihei
For Me.ct1 = 0 To oriwid
onepixel = ""
While picpart.Substring(ct2, 1) <> "?"
onepixel += picpart.Substring(ct2, 1)
ct2 += 1
End While
c = Color.FromArgb(Val(onepixel.Substring(0, 3)), Val(onepixel.Substring(3, 3)), Val(onepixel.Substring(6, 3)), Val(onepixel.Substring(9, 3)))‘读字符串里的argb’
b.SetPixel(ct, ct1, c)'想setpixel但是没用
Next
ProgressBar2.Value += 1
Next
Form1.PictureBox1.Image = b
Form1.PictureBox1.Image.Save(ExportTb.Text)
2017年10月18日 12点10分 2
level 10
Dim pic New Bitmap(pic1.Width, pic1.Height)
Dim g = Graphics.FromImage(pic)
g.Clear(Me.BackColor)
Dim ele As oneLine
For i As Integer = 0 To lines.Count - 1
ele = lines.Item(i)
g.DrawLine(pen, ele.one.X, ele.one.Y, ele.two.X, ele.two.Y)
Next
If first <> Nothing Then g.DrawLine(pen, first.X, first.Y, second.X, second.Y)
pic1.Image = pic
g.Dispose()
一般不推荐直接画点,可以用DrawLine代替,画1个像素长度的线
2017年10月19日 09点10分 3
Dim pen As New Pen(Color.Black)
2017年10月19日 09点10分
1