none
Creating a Array of Rectangles in c# using WPF

    Question

  • i want to create an array of rectangles in WPF using c#. basically i am making an animation which depicts the moving of cars on a straight road . So i need a lot of rectangles to demonstrate the car

    the code i used for creating a rectangle is 

    Rectangle vehicle1 = new Rectangle();
    vehicle1.Width = 15 ;
    vehicle1.Height = 15 ;

    i want something so that i can use a rectangle array like

    for (int i =0;i<10;i++)
    {
    vehicle[i].width= 15;
    vehicle[i].height=15;
    }
    
    

    CAN somebody supply the exact code ?

    Since String is a class and we can use string arrays i am hoping that rectangle arrary exists.


    arka Bhattacharya

    Wednesday, September 19, 2012 11:15 PM

Answers

All replies