Title | Compose four pictures into a single picture and save the result into a file |
Description | This example shows how to compose four pictures into a single picture and save the result into a file in Visual Basic 6. |
Keywords | compose, composition, picture, PictureBox, PaintPicture |
Categories | Graphics, Controls |
|
Private Sub Form_Load()
Dim file_path As String
file_path = App.Path
If Right$(file_path, 1) <> "\" Then file_path = _
file_path & "\"
picResult.Width = ScaleX(2 * 72, vbPixels, vbTwips) + _
picResult.Width - picResult.ScaleWidth
picResult.Height = ScaleY(2 * 90, vbPixels, vbTwips) + _
picResult.Height - picResult.ScaleHeight
Width = picResult.Width + 2 * picResult.Left + Width - _
ScaleWidth
Height = picResult.Height + 2 * picResult.Top + Height _
- ScaleHeight
picResult.AutoRedraw = True
picResult.ScaleMode = vbPixels
' Get the pictures.
picHidden.Picture = LoadPicture(file_path & "ccls.jpg")
picResult.PaintPicture picHidden.Picture, 0, 0
picHidden.Picture = LoadPicture(file_path & _
"offices.jpg")
picResult.PaintPicture picHidden.Picture, 72, 0
picHidden.Picture = LoadPicture(file_path & _
"vb_prog_refs.jpg")
picResult.PaintPicture picHidden.Picture, 0, 90
picHidden.Picture = LoadPicture(file_path & "vbgps.jpg")
picResult.PaintPicture picHidden.Picture, 72, 90
' Save the result.
picResult.Picture = picResult.Image
SavePicture picResult.Picture, file_path & "4pics.bmp"
End Sub
|