Can I convert my VB code to C++? How can I do it?
This is my VB code:
Dim OpenFileDialog1 As New OpenFileDialog
Wit开发者_如何学JAVAh 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
Well you can convert it to C++, and using a graphical library might be the easiest way to do so.
I recommend using Qt. It is a fairly simple graphical framework which works on several platforms. We currently don't know which platform you target, however I assume you're targeting Windows since you showed an example in Visual Basic.
Typically, using Qt classes QFileDialog
and QPicture
, you should be able to achieve your goal quite quick.
The framework is shipped with a whole set of simple examples. One of them is exactly what you ask.
Here is an MSDN-Example for an OpenFileDialog using the WinAPI.
精彩评论