0

有没有办法在控制台应用程序中模拟图片框?我试过这种方式,但图像总是返回完全黑色:

    Using P As New PictureBox
        P.Size = New Point(255, 255)
        P.Image = New Bitmap(255, 255) 'I did set a real image, but I didn't for the sake this example
    End Using
4

1 回答 1

0

假设您已导入显示表单所需的所有内容,请不要使用 form.Show 方法。相反,用于Application.Run(New Form1)显示表单。这篇文章有一个更完整的答案。

您可以在设计器中设计表单,按原样使用它,或将其声明为新对象并更改任何属性并将新对象传递给Run方法。

Imports System.Drawing
Imports System.Windows.Forms
Module Module1

    Sub Main()
        Dim newform1 As New Form1
        newform1.PictureBox1.Image = New Bitmap("MyImageFile")
        Application.Run(newform1)
        Console.ReadLine()
    End Sub

End Module
于 2013-10-31T16:10:30.037 回答