我想在
setPixel
函数中更改像素的大小。
当我使用
setPixel
功能时。它画了一个像素。但它很小。
有没有办法改变
setPixel
函数中像素的大小?
我记得在VB6中,PictureBox的属性中有一个属性叫做
DrawWidth
。在此属性中,我可以更改绘图的大小。
也许我必须在 VB.NET 中使用这个属性。但我在VB.NET中的PictureBox的属性中没有找到它。
一个快速的选择是放大较小的图像
'draw a small bitmap
Dim bmp = New Bitmap(25, 25)
For y = 0 To 24
For x = 0 To 24
If x = y Then
bmp.SetPixel(x, y, Color.Red)
End If
Next x
Next y
'scale it up 4x
Dim bmpBigger = New Bitmap(bmp, 100, 100)
PictureBox1.Image = bmpBigger
不过,输出可能有点模糊。为了得到你想要的,你需要使用
Graphics
类