Form.Invalidate(...)
Does anyone have any idea which of these is more efficient?
Code:
List<Rectangle> rectangles;
//some code to build the list (up to 56 rectangles)
// (1) is this the quickest?
foreach (Rectangle rect in rectangles)
this.Invalidate(rect);
// (2) or is this?
Region region = new Region();
foreach (Rectangle rect in rectangles)
region.Union(rect);
this.Invalidate(region);
OR... is it dependent on too many other factors to make a judgement?
Incidentally, in my scenario, if I use the region (2) option, then I don't need to build the list of rectangles beforehand, I can just add them to the region as they are created. This is because either the List<Rectangle> or the Region is returned from another function and not actually created in the same routine as in my example above.
Last edited by rliq; April 7th, 2010 at 07:28 PM.
Rob
-
Ohhhhh.... Old McDonald was dyslexic, E O I O EEEEEEEEEE.......
Bookmarks