-
Oct 25th, 2013, 01:24 AM
#1
Saving A Picture
How do I save a Picture that I BitBlt'd on?
I can save a picture that I printed on by using Picture1.Image but this doesn't work for BitBlt
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
-
Oct 25th, 2013, 01:58 AM
#2
VB.NET MVP 2008 - Present
-
Oct 25th, 2013, 05:47 PM
#3
Re: Saving A Picture
Doesn't give me a clue, not even close
The only remark given was to use SavePicture but that I have already tried and only the picture is saved whether I use Picture1.Picture or Picture1.Image but not anything that was BitBlt'd on it
It will, however save anything that was printed on it like text from using Picture1.Print
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
-
Oct 25th, 2013, 05:53 PM
#4
Re: Saving A Picture
Not sure if this would be of use or not?
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Oct 25th, 2013, 07:51 PM
#5
Re: Saving A Picture
1) If you haven't already, set the Picture box's AutoRedraw property to True.
2) In your code, add the line "Picture1.Picture = Picture1.Image" just before your SavePicture call.
3) In the actual SavePicture call, use the .Picture property, e.g. SavePicture Picture1.Picture, "C:\filename.bmp"
When applying any GDI API calls (BitBlt, SetPixel, StretchDIBits, etc) to a picture box, you must always set the picture box's .Picture equal to its .Image before using internal VB functions like SavePicture.
-
Oct 25th, 2013, 09:25 PM
#6
Re: Saving A Picture
Make sure you set the picture box's .AutoRedraw property to true *before* using BitBlt. (Unless you have reason to do otherwise, set .AutoRedraw to True at design-time.)
If you do that, does it solve the problem?
Also, I know it's obvious, but do you have both the picture box and user control .ScaleMode properties set to "3 - Pixel"?
-
Oct 25th, 2013, 09:39 PM
#7
Re: Saving A Picture
OMG! Yes, it works. Why it never entered my mind to set AutoRedraw to True before BitBlt'ng I don't know. I'm so stupid at times
EDIT: I inadvertently deleted my previous post
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
-
Oct 26th, 2013, 07:38 AM
#8
Re: Saving A Picture
Nothing stupid about it! Those kind of bugs hit everyone at some point.
I do a lot of work with graphics in VB, and I have found those steps above (.AutoRedraw = True, do all your API graphics, PictureBox.Picture = PictureBox.Image) to be pretty much foolproof. Also, I really would recommend setting .AutoRedraw to True at design-time. It can save you the headache of tracking down annoying bugs like this one.
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
|