Draw picture into image (picturebox)

the-copy
02-19-2005, 04:12 AM
I have a app where i can draw stuff onto a picture.

Can a draw i picture on the picturebox's image?

passel
02-19-2005, 06:39 AM
Depends on what you mean by draw a picture.

There are several approaches you can take. I guess if you want to place copies of
a picture on a picturebox then bitblt or PaintPicture might do what you want.

Example of using PaintPicture:

Put two pictureboxes on the form.
Set picture2.Visible to false, and picture2.Autosize to True.
Load a picture into Picture2.Picture.

Increase the size of Picture1 to whatever size you want.
Add a command button, and paste in this code.
It will draw the picture2.picture into picture1.picture in three random
locations, each time you click on it.

You can expand on the code from there.


Private Sub Command1_Click()
Picture1.Cls
For i = 1 To 3:
x = Picture1.ScaleWidth / 2 * Rnd
y = Picture1.ScaleHeight / 2 * Rnd
Picture1.PaintPicture Picture2.Picture, x, y
Next
End Sub



Or add this, and click and drag in your picture1 window.


Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Picture1.PaintPicture Picture2.Picture, X, Y
End If
End Sub

the-copy
02-19-2005, 05:06 PM
Depends on what you mean by draw a picture.

There are several approaches you can take. I guess if you want to place copies of
a picture on a picturebox then bitblt or PaintPicture might do what you want.

Example of usi...



Yes! Thank you very much!


:)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum