-
August 28th, 2010, 09:45 PM
#1
Array of Schedule Rectanges
I am trying to display 8 schedule block rectangles on my grid.
Rectangle[] ScheduleRectangle;
for (i = 0; i < 8; i++)
{
ScheduleRectangle[i] = new Rectangle();
ScheduleRectangle[i].Height = 28;
ScheduleRectangle[i].Width = 576;
Grid.SetColumn(ScheduleRectangle[i], 1);
ScheduleRectangle[i].StrokeThickness = 1;
ScheduleRectangle[i].Stroke = Brushes.Black;
ScheduleRectangle[i].HorizontalAlignment = HorizontalAlignment.Left;
ScheduleRectangle[i].VerticalAlignment = VerticalAlignment.Top;
ScheduleRectangle[0].Margin = new Thickness(87, 140+(i*80), 0, 0);
MiscGrid.Children.Add(ScheduleRectangle[i]);
}
It compiles, but throws an exception. It gives an error if I try to define the array within the for loop. What's the correct way to do this? Thanks.
Sutton
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|