Results 1 to 5 of 5

Thread: Clear a Rectangle I've drawn?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2007
    Posts
    330

    Clear a Rectangle I've drawn?

    Hello again
    So; I've drawn this rectangle

    vb Code:
    1. Dim zr As New Rectangle(100, 100, 100, 100)
    2.             e.Graphics.DrawRectangle(Pens.Red, zr)
    and I want to clear it.
    any idea?

  2. #2
    Fanatic Member Vectris's Avatar
    Join Date
    Dec 2008
    Location
    USA
    Posts
    941

    Re: Clear a Rectangle I've drawn?

    e.Graphics.Clear or something like that.
    If your problem is solved, click the Thread Tools button at the top and mark your topic as Resolved!

    If someone helped you out, click the button on their post and leave them a comment to let them know they did a good job

    __________________
    My Vb.Net CodeBank Submissions:
    Microsoft Calculator Clone
    Custom TextBox Restrictions
    Get the Text inbetween HTML Tags (or two words)

  3. #3
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: Clear a Rectangle I've drawn?

    If you want to clear only that part, just draw over it again. Drawing twice clears it.
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2007
    Posts
    330

    Re: Clear a Rectangle I've drawn?

    Quote Originally Posted by Vectris View Post
    e.Graphics.Clear or something like that.
    That clears the whole page. -.-

  5. #5
    Master Of Orion ForumAccount's Avatar
    Join Date
    Jan 2009
    Location
    Canada
    Posts
    2,802

    Re: Clear a Rectangle I've drawn?

    Well you should be painting it in the Paint event, so invalidate the control that you are painting this on, but don't redraw the rectangle.

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