|
-
Dec 8th, 2004, 03:14 AM
#1
Thread Starter
Junior Member
VB: SavePicture PictureBox -[RESOLVED]-
Hi
I am trying to save a picturebox into a ".bmp" file afterdrawing something on the picturebox, but it is not working for me. what I am getting is, a blank bitmap file with the same color as the background color of the picturebox, I am giving the code what I am doing to save the drawing
'***********************************************
Const SRCCOPY = &HCC0020 ' (DWORD) dest = source
Private Declare Function StretchBlt Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture1.PSet (X, Y)
End Sub
Private Sub Command1_Click()
StretchBlt Picture2.hdc, 0, 0, 100, 100, Picture1.hdc, 0, 0, 100, 100, SRCCOPY
End Sub
Private Sub Command2_Click()
SavePicture Picture2.Image, "c:\tp.bmp"
MsgBox ("Done")
End Sub
'***********************************************
can anyone help me to solve my problem.
kajol
Last edited by Electroman; Dec 9th, 2004 at 03:55 AM.
Reason: Added Language to title & Added Resolved to title.
-
Dec 8th, 2004, 06:14 AM
#2
Ex-Super Mod'rater
Re: SavePicture PictureBox
Is AutoReDraw set to True?
When your thread has been resolved please edit the original post in the thread (  )
and amend "-[RESOLVED]-" to the end of the title and change the icon to  , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

-
Dec 8th, 2004, 11:54 PM
#3
Thread Starter
Junior Member
Re: VB: SavePicture PictureBox
Thanks for your tip, the AutoRedraw was not set to true, now it is working. Thanks again
Kajol
-
May 28th, 2012, 12:48 PM
#4
New Member
Re: VB: SavePicture PictureBox -[RESOLVED]-
Dear kajol,
what you mean by "Const SRCCOPY = &HCC0020 ' (DWORD) dest = source"?
I try to do the same thing as you but I don't understand the coding. Please help me
-
May 28th, 2012, 10:49 PM
#5
Re: VB: SavePicture PictureBox -[RESOLVED]-
 Originally Posted by peacemakerxx
Dear kajol,
what you mean by "Const SRCCOPY = &HCC0020 ' (DWORD) dest = source"?
I try to do the same thing as you but I don't understand the coding. Please help me
Not sure if you realize it but you opened a post from 8 years ago.
Bitblt, Stretchblt, and Transparentblt are APIs which are graphical functions used from the gdi32 dll file found in your windows folder. These use hexadecimal tags for souce and destination of where to blit the image. In this case its stretchblt and is using SRCCOPY, which means its getting the image info from its source handle (pointer, or hDC) such as a picturebox, and copies it. Then savepicture saves it to file.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|