Results 1 to 8 of 8

Thread: Picturebox Redraw Problem

  1. #1

    Thread Starter
    Fanatic Member Geespot's Avatar
    Join Date
    Oct 2001
    Location
    Birmingham, UK
    Posts
    577

    Picturebox Redraw Problem

    Hi

    Because vb.net no longer has a autoredraw property on there picturebox's i had to put all the drawing code into this..

    Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)


    no that works fine, i can move the picturebox off screen, bring it back and it will redraw it self


    but it doesnt seem to work when i have the picturebox inside a panel ( which i need because of the scrollbars ). If i scroll the picturebox around using the panels scrollbars its as if the (vb6) autoredraw = false

    How can i overcome this problem?

  2. #2
    Lively Member slx47's Avatar
    Join Date
    Apr 2002
    Location
    US
    Posts
    127
    dont use a panel then, use a another picture box or something ...

  3. #3
    hellswraith
    Guest
    It works great for me. All you need to do is make the PictureBox's SizeMode property Autosize, and the panel's AutoScroll property to true. Then when the picture in the picturebox is larger than the panel, the scrollbars will appear automatically. Just put the top left corner of the picture box in the top left corner of the panel. I have not a single problem with this configuration.

  4. #4

    Thread Starter
    Fanatic Member Geespot's Avatar
    Join Date
    Oct 2001
    Location
    Birmingham, UK
    Posts
    577
    Sadly i cant use sizemode=autosize because im not using a ready made image

    slx47: i have a feeling the same will happen with another picturebox anyway


    heres a image showing whats wrong




    all the white part around the grid is there because i scrolled the picturebox with the panels scrollbars
    but if i move the form off the screen and bring it back again, it will redraw it self correctly

  5. #5
    Member wej42's Avatar
    Join Date
    May 2002
    Location
    Rhode Island, USA
    Posts
    48
    me.refresh try that?
    Visual Basic 6.0, Visual Basic .NET, C#, C++, ASM, HTML

  6. #6

    Thread Starter
    Fanatic Member Geespot's Avatar
    Join Date
    Oct 2001
    Location
    Birmingham, UK
    Posts
    577
    done it, I had to create a BITMAP variable and do my normal drawing onto that

    then on the normal picturebox Paint event, just copy the Bitmap variable to the picturebox.image

    works a treat and hardly any flicker

  7. #7
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    what's the program you are making anyways?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  8. #8

    Thread Starter
    Fanatic Member Geespot's Avatar
    Join Date
    Oct 2001
    Location
    Birmingham, UK
    Posts
    577
    Icon editor, for no reason, just to get practise with vb.net

    coming along great

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