在VB.NET中从宽度和高度生成空白图像

问题描述 投票:-4回答:1

我想制作一个具有一定宽度和高度的空白画布位图图像,在VB.NET中,我使用Visual Studio 2017,使用Windows窗体应用程序和.NET Framework 4.6.1。

我尝试使用带有宽度和高度参数的新图像创建一个新的位图图像,但这并没有真正解决。我试着看看和预期的参数,但它并没有真正显示我。

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  Dim Image = New Bitmap(New Image(WidthInput.Value, HeightInput.Value))
End Sub

我希望结果是宽度为WidthInput.Value和高度为HeightInput.Value的图像,即纯白色或任何其他颜色。

vb.net image random
1个回答
1
投票

我做了更多的研究,发现我可以pass the width and height through the Bitmap constructor。宽度和高度需要是Int32的类型。

© www.soinside.com 2019 - 2024. All rights reserved.