JaskiratBoparai
JaskiratBoparai

Reputation: 87

Using common dialog to save picturebox as image vb6

I am using the common dialog control to save a picturebox in my form as an image. However, when I test it out, the bmp file that is produced is blank.

I am using the line function to draw lines on the picutrebox. This is what I want to save.

My code:

Private Sub mnuFileSave_Click()

Dim FileName As String

savedlg.FileName = ""
savedlg.Filter = "Bitmap files (*.bmp)|*.bmp|"
savedlg.ShowSave
If savedlg.FileName = "" Then Exit Sub
picGraph.Picture = picGraph.Image
SavePicture picGraph.Picture, savedlg.FileName

End Sub

Any help as to why the saved bmp file is coming up blank would be appreciated, thanks.

Edit: I have also found that the picture box goes blank when the picture is saved as an image.

Upvotes: 0

Views: 1955

Answers (1)

JaskiratBoparai
JaskiratBoparai

Reputation: 87

Answer is simple:

AutoRedraw on the picture box must be set to true. It was set to false before.

Upvotes: 2

Related Questions