Results 1 to 6 of 6

Thread: [RESOLVED] Bitmaps/Pictureboxes/Autoredraw/Refresh

  1. #1

    Thread Starter
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Resolved [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)

  2. #2
    Lively Member Elvenstone's Avatar
    Join Date
    Feb 2008
    Location
    Rotterdam (Netherlands)
    Posts
    122

    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.

  3. #3
    Cumbrian Milk's Avatar
    Join Date
    Jan 2007
    Location
    0xDEADBEEF
    Posts
    2,448

    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.

  4. #4
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Bitmaps/Pictureboxes/Autoredraw/Refresh

    After the API call have you tried, pic2.Picture = pic2.Image

  5. #5

    Thread Starter
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Re: Bitmaps/Pictureboxes/Autoredraw/Refresh

    Quote 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.
    Quote 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.
    Quote 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)

  6. #6

    Thread Starter
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Re: Bitmaps/Pictureboxes/Autoredraw/Refresh

    Quote 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
  •  



Click Here to Expand Forum to Full Width