gRoberts12 Posted August 5, 2005 Posted August 5, 2005 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 Gavform1.txtgeneric.cs.txt Quote
Administrators PlausiblyDamp Posted August 5, 2005 Administrators Posted August 5, 2005 In the resize event have you tried private void Form1_Resize(object sender, System.EventArgs e) { panel10.CreateGraphics().Clear(); this.panel10.Invalidate(); } Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
gRoberts12 Posted August 8, 2005 Author Posted August 8, 2005 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 Quote
Administrators PlausiblyDamp Posted August 8, 2005 Administrators Posted August 8, 2005 The code you posted wasn't doing what I suggested though you are doing panel10.Controls.Clear(); rather than panel10.CreateGraphics().Clear(); Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
gRoberts12 Posted August 9, 2005 Author Posted August 9, 2005 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 Quote
gRoberts12 Posted August 9, 2005 Author Posted August 9, 2005 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 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.