VB.NET绘制图像(设置像素)

时间:2012-06-21 18:17:15

标签: vb.net winforms pixel

假设我想创建宽度和高度为64的图像并将所有像素设置为黑色

dim b as bitmap

b.width = 64
b.height = 64

for y = 0 to 64
    for x = 0 to 64
        b.setpixel(x,y ,color.black)
    next
next

dim p as new panel

p.width = b.width
p.hieght = b.height
p.backgroundimage(b)

代码无效

1 个答案:

答案 0 :(得分:0)

    Dim b As Bitmap = New Bitmap(64, 64)

    For y = 0 To 64

        For x = 0 To 64

            b.SetPixel(x, y, Color.Black)

        Next

    Next

    b.Save("bitmap1.bmp")