Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

  • Leaders
Posted

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. :)

Iceplug, USN

One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...