Link to home
Start Free TrialLog in
Avatar of ajaybhalekar
ajaybhalekar

asked on

want to copy image from picturebox to imagebox

Hello
i am drawing on the picturebox and as i can draw on picture box i want to copy the drawn image from picture box to imagebox
as picturebox cant be transparent i am using the imagebox,but as using imagebox i cant  draw on the picture how is it posible to copy the drawn image from picture box to imagebox or is it possible to make picture box transparent or is it possible to draw on imagebox
Avatar of VincentLawlor
VincentLawlor

Image1.Picture = Picture1.Picture ?

Vin.
SavePicture Statement Example
This example uses the SavePicture statement to save a graphic drawn into a Form object?s Picture property. To try this example, paste the code into the Declarations section of a Form object, and then run the example and click the Form object.

Private Sub Form_Click ()
   ' Declare variables.
   Dim CX, CY, Limit, Radius   as Integer, Msg as String
   ScaleMode = vbPixels   ' Set scale to pixels.
   AutoRedraw = True ' Turn on AutoRedraw.
   Width = Height   ' Change width to match height.
   CX = ScaleWidth / 2   ' Set X position.
   CY = ScaleHeight / 2   ' Set Y position.
   Limit = CX   ' Limit size of circles.
   For Radius = 0 To Limit   ' Set radius.
      Circle (CX, CY), Radius, RGB(Rnd * 255, Rnd * 255, Rnd * 255)
      DoEvents   ' Yield for other processing.
   Next Radius
   Msg = "Choose OK to save the graphics from this form "
   Msg = Msg & "to a bitmap file."
   MsgBox Msg
   SavePicture Image, "TEST.BMP"   ' Save picture to file.
End Sub

Hope this helps
WoK
Try this.

When you are drawing on your picture box call the following.

Image1.Picture = Picture1.Image
Image1.Refresh

Vin.
Here is the final code:


Private Sub Image1_Click()
  Set Image1.Picture = LoadPicture("C:\TEST.BMP")
End Sub

Private Sub Picture1_Click()
  Dim CX, CY, Limit, Radius   As Integer, Msg As String
  Picture1.ScaleMode = vbPixels   ' Set scale to pixels.
  Picture1.AutoRedraw = True ' Turn on AutoRedraw.
  Picture1.Width = Picture1.Height
  CX = Picture1.ScaleWidth / 2   ' Set X position.
  CY = Picture1.ScaleHeight / 2   ' Set Y position.
  Limit = CX   ' Limit size of circles.
  For Radius = 0 To Limit   ' Set radius.
     Picture1.Circle (CX, CY), _
     Radius, RGB(Rnd * 255, Rnd * 255, Rnd * 255)
     DoEvents   ' Yield for other processing.
  Next Radius
  SavePicture Image, "C:\TEST.BMP"
End Sub

Good coding
WoK ;o)
Private Sub Image1_Click()
  'Set Image1.Picture = LoadPicture("C:\TEST.BMP")
   Image1.Picture = Picture1.Image
   Image1.Refresh
End Sub

Will work too ...
WoK
WoK>>
Think I suggested that already.

Vin.
Private Sub Image1_Click()
  'Set Image1.Picture = LoadPicture("C:\TEST.BMP")
   Image1.Picture = Picture1.Image
   Image1.Refresh
End Sub

Will work too ...
WoK
Yes, sorry but this will help ajaybhalekar
...
;o)
Avatar of Richie_Simonetti
maybe....

dim pic as stdpicture

'and when you are finish drawing on picturebox
set pic=picture1.picture
set image1.picture=pic
ASKER CERTIFIED SOLUTION
Avatar of Ark
Ark
Flag of Russian Federation image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
TransperantBlt in image32.dll :-)
TransperantBlt() image32.dll :-))
Great answer, Mikesun.
Did you look at code EXACTLY above your "answer"?

Cheers
BLAMABLE Mikesun!
Rejecting MikeSun's answer.

Mikesun, please read the guidelines for 'Comments and Answers' https://www.experts-exchange.com/admin/adminShow.jsp?qid=20160770#tip

costello
Community Support Moderator @ eE