-
Mar 5th, 2008, 10:38 AM
#1
[RESOLVED] Bitmaps/Pictureboxes/Autoredraw/Refresh
I'm using SetDIBitsToDevice to plot a 2D array to a picturebox, pic1, which is invisible. Previous to that I make its width and height equal to the array's number of rows and columns. Then I use StretchBlt to copy from pic1 to a larger visible picturebox, pic2.
If pic1 is visible everything works fine, but if it's not then nothing appears in pic2. I suspect it may be a matter of using the correct settings for the autoredraw properties and refresh methods of pic1 and pic2 but I've been fooling around, groping you might say, without finding the correct recipe.
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
-
Mar 5th, 2008, 10:49 AM
#2
Lively Member
Re: Bitmaps/Pictureboxes/Autoredraw/Refresh
Just thinking out loud, I'd say: set the coordinates to -[large number] and keep it visible, just not to the user.
-
Mar 5th, 2008, 11:05 AM
#3
Re: Bitmaps/Pictureboxes/Autoredraw/Refresh
...it should work when it's invisible, certainly BitBlt has no problems then. Just as long as the source and target have AutoRedraw set to true.
I remember you mentioning this a while ago and shortly after I remembered the StretchDIBits Api which as it's name suggests works the same as StretchBlt but it uses a array as source. Also, you may (or may not) find using SetStretchBltMode Api to set the stretch mode to HALFTONE(&H4) gets you better results.
-
Mar 5th, 2008, 11:05 AM
#4
Re: Bitmaps/Pictureboxes/Autoredraw/Refresh
After the API call have you tried, pic2.Picture = pic2.Image
-
Mar 5th, 2008, 01:07 PM
#5
Re: Bitmaps/Pictureboxes/Autoredraw/Refresh
Originally Posted by Milk
...it should work when it's invisible, certainly BitBlt has no problems then. Just as long as the source and target have AutoRedraw set to true.
It does work Probably I must have checked all kinds of combinations but both pboxes' autoredraw set to true.
Originally Posted by Milk
I remember you mentioning this a while ago and shortly after I remembered the StretchDIBits Api which as it's name suggests works the same as StretchBlt but it uses a array as source.
The way I'm working is I do all the image processing -contrast & brightness, flip & rotate, etc- in the invisible pbox and then update the visible one.
Originally Posted by Milk
Also, you may (or may not) find using SetStretchBltMode Api to set the stretch mode to HALFTONE(&H4) gets you better results.
Yes, that's precisely what I'm using.
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
-
Mar 5th, 2008, 01:10 PM
#6
Re: Bitmaps/Pictureboxes/Autoredraw/Refresh
Originally Posted by Edgemeal
After the API call have you tried, pic2.Picture = pic2.Image
No, it doesn't work. The only way it works is when autoredraw is true for both pictureboxes as Milk said.
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
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
|