clear panel on resize!

gRoberts12

Newcomer
Joined
Aug 5, 2005
Messages
7
Hey peeps,

need some help if possible! I have developed an application for work that displays our warehouse graphically using the fillRectangle method of the graphics class.

Now what we have at the moment, is when the user resizes the form, it does redraw the data in the way we intend it to, but also keeps the original drawing in place, so infact we now have two different sized array of drawings,

View attachment for a visual representation. ( Totally skinned down gif, no color no fancy graphics, just b&w pure filth )

For coding, I have added the text to text files rather then adding the whole project.

Gav

Cheers all

Gav
 

Attachments

In the resize event have you tried
C#:
       private void Form1_Resize(object sender, System.EventArgs e)
        {
            panel10.CreateGraphics().Clear();
            this.panel10.Invalidate();
        }
 
that didn't work my friend, as you can see from my pic, it's drawing over it's self each time, rather then clearing then creating a new set of boxes.

Does any one know how I can clear the panel canvas, then draw on it again.

Cheers

Gav
 
okies,

The crack is, I have a database that contains position information for our warehouse. We already have a piece of software in place but it's unreliable and coded in vb6. Now I've started coding in c#.net and with the data in the database I have drawn rectangles to show that data, this works great. But we have added a function that when resized it zoom's in and out etc. But when it invalidates it redraws the new boxes as intended but keeps the original boxes in place, so now I have two sets of boxes overlapping each other.

I've tried almost everything, but for some weird reason it doesn't work.

Can you help?

Gav
 
got it sorted, I had an MessageBox.Show in there that displayed how many items were in the array and that was invalidating the panel after the user clicked ok.

Removed this and it works great.

Gav
 
Back
Top