我可以将VB代码转换为C++代码

shu*_*ubu 2 c++ vb.net translation

我可以将VB代码转换为C++吗?我该怎么做?

这是我的VB代码:

Dim OpenFileDialog1 As New OpenFileDialog

With OpenFileDialog1
    .CheckFileExists = True
    .ShowReadOnly = False
    .Filter = "All Files|*.*|Bitmap Files (*)|*.bmp;*.gif;*.jpg"
    .FilterIndex = 2
    If .ShowDialog = DialogResult.OK Then
        ' Load the specified file into a PictureBox control.
        PictureBox1.Image = Image.FromFile(.FileName)
    End If
End With
Run Code Online (Sandbox Code Playgroud)

ere*_*eOn 5

那么你可以转换为C++,使用图形库可能是最简单的方法.

我推荐使用Qt.它是一个相当简单的图形框架,可在多个平台上运行.我们目前不知道您定位的是哪个平台,但是我假设您在Windows中展示了一个示例,因此您的目标是Windows.

通常,使用Qt类QFileDialogQPicture,你应该能够实现自己的目标相当快.

该框架附带了一整套简单的示例.其中一个正是你所要求的.