BryanZM Posted June 15, 2004 Posted June 15, 2004 Hello, First of all just let me say that Im relatively new to the drawing namespace. Here is what im trying to do: // Declare an array of rectangles... Rectangle[] rects = { new Rectangle(0,0,0,0), new Rectangle(0,0,0,0), new Rectangle(0,0,0,0), new Rectangle(0,0,0,0), new Rectangle(0,0,0,0), new Rectangle(0,0,0,0), new Rectangle(0,0,0,0), new Rectangle(0,0,0,0), new Rectangle(0,0,0,0), new Rectangle(0,0,0,0) } ; bTimes = 5 ; for(int i = 0;i<bTimes;i++) { yway = 5 * i ; rects = new Rectangle(xway,yway,23,12) ; } g.DrawRectangles(pen,rects) ; When the loop completes there is only one rectangle, allthough im pretty sure the array is filled with rectangles and I think it should draw them.... Also how can I define a empty array of rectangles with just a specified size??? Any help would be greatly apprectiated!!! Thanks, Bryan Quote
Leaders Iceplug Posted June 16, 2004 Leaders Posted June 16, 2004 Have you tried changing the rectangles that you create in the array initializer? You should set their Widths and Heights, otherwise the rectangle is empty, and it won't be drawn. You also have ten rectangles there, but you're only setting five of them in the for loop. :) Quote Iceplug, USN One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(
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.