silverlight change the brush but without allocating it...

Last post 10-19-2009 2:14 PM by gmmo1971. 1 replies.

Sort Posts:

  • silverlight change the brush but without allocating it...

    10-19-2009, 2:01 AM
    • Member
      14 point Member
    • gmmo1971
    • Member since 06-01-2008, 6:10 PM
    • Posts 67

    Hi, i have an array of rectangles.


    I need to change the color of the rectangles, but I don't want to allocate another brush again.


    			for (int ii = 0; ii < cRectArr; ii++)
    			{
    				Brush brush = rect[ii].Fill;
    
    				//how do I change the color without creating a new brush?
    
    
    			}
    


    I can get the brush pointer but don't know how to change the color.


    Is there some syntax that I can do that (SetValue?)


    thx.

  • Re: silverlight change the brush but without allocating it...

    10-19-2009, 2:14 PM
    • Member
      14 point Member
    • gmmo1971
    • Member since 06-01-2008, 6:10 PM
    • Posts 67

    nevermind. I was too tired last night. This was a stupid question:


    SolidColorBrush brush = (SolidColorBrush)rect[ii].Fill;
    brush.Color = Color.FromArgb(255, colorTmp, colorTmp, colorTmp);

    SolidColorBrush brush = (SolidColorBrush)rect[ii].Fill;
    brush.Color = Color.FromArgb(255, colorTmp, colorTmp, colorTmp);
    


Page 1 of 1 (2 items)