VB.net 2005 - Can you make a handmade graphic (drawrectangle and drawline) permanent?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Joca
    New Member
    • Jul 2008
    • 10

    VB.net 2005 - Can you make a handmade graphic (drawrectangle and drawline) permanent?

    I've made a private sub that creates a graphic (using drawrectangle, string, line and stuff like that) inside a picturebox, so i wouldnt place it right on top of the form itself and also beeing able to move it around. I was aware that the graphic would disappear whenever you minimize or have windows on top it, but was under the impression that all i needed to do for it to stay there was to call the sub in the forms' paint event.
    However, this doesnt seem to work very well and i keep getting my picturebox empty at times. I've tried using a timer to run the sub at a steady interval, and it works, but the graphic flickers due to the constant updating.
    I'm an absolute newbie at this and would appreciate any help.

    Thanks in advance.
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Create a bitmap object, then a graphics object from it. Then draw on that graphics object. You can then use the bitmap object wherever you want.

    Comment

    • Joca
      New Member
      • Jul 2008
      • 10

      #3
      I appreciate your fast answer and will try to make it on my own, but can i ask you for a code example?

      Edit: By permanent i meant, a graphic that would always be displayed inside the picturebox and not a way to save it to the harddrive. I dont know if that makes any difference on what you explained.

      Comment

      • Joca
        New Member
        • Jul 2008
        • 10

        #4
        Nevermind that, I managed to figure it out with your explanation.
        My thanks for your great help!

        Comment

        Working...