Results 1 to 6 of 6

Thread: AutoRedraw??

  1. #1

    Thread Starter
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    AutoRedraw??

    Remember VB6's good-old Autoredraw property for forms and pictureboxes etc?

    What is the equivalent code in VB.net? I'm trying to draw lines on a form but they wont stay put if I minimize/maximize the form.
    I don't live here any more.

  2. #2
    Lively Member
    Join Date
    Jan 2002
    Posts
    105
    I think you can use .Refresh.......I think!

  3. #3

    Thread Starter
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Wink

    Unfortunately not, that has the opposite effect.

    Anyone else?
    I don't live here any more.

  4. #4
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    When you create an instance of the graphics instance, and point it to a form, you are simply drawing on the form. Once the form refreshes, you lose anything you have drawn.

    The reason is when the OS or the form event handler tells the form to redraw itself, it only draws what is in its Paint event. If you want something to persist, you must take of it there.

    You need to add your own code that basically determines if it should add something to the paint event, or gloss over it.

    VB Code:
    1. If _PaintLines Then
    2.  'loop through my shapes collection
    3.  'and draw them
    4. End If

  5. #5
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    just to make it more clear

    put your draw code in the paint even of the form. This may be sometimes inefficient, as everytime the form is "refreshed" it will redraw everything again. But sometimes this is better, I dont know, depends to you

    the other way would be to draw the image on a bitmap or an Image object, and then set that to your form's backgroundImage. If you do this one, you wont have to redraw it. it will just stay there, just as you would have a picture in a picturebox
    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!!

  6. #6

    Thread Starter
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682
    That sounds promising, thanks, I'll try it.
    I don't live here any more.

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