locked
add MultiColors in SolidBrush.in C# RRS feed

  • Question

  • User1521544757 posted

    Hi i m use

    SolidBrush drawBrush = new SolidBrush(Color.Black);

    How to add MultiColors in SolidBrush..pls help me

    Saturday, April 14, 2012 4:09 AM

Answers

  • User-417784260 posted

    The solidBrush only supports 1 color at a time. There is no way to add more than one color.    Maybe you are look for a GradientBrush

     

    http://msdn.microsoft.com/en-us/library/s6fxh562.aspx

     

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, April 14, 2012 5:22 AM
  • User-417784260 posted

    Each time you draw the rectangle it over writes the old rectangle because it is bigger.  You should start with the largest rectangle and end with the smallest. 

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, April 14, 2012 7:16 AM

All replies

  • User-417784260 posted

    The solidBrush only supports 1 color at a time. There is no way to add more than one color.    Maybe you are look for a GradientBrush

     

    http://msdn.microsoft.com/en-us/library/s6fxh562.aspx

     

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, April 14, 2012 5:22 AM
  • User-691245060 posted

    Multiple Colors wiht LinearGradientBrush - http://thenewboston.org/watch.php?cat=15&number=125 

    Thanks,

    Saturday, April 14, 2012 6:00 AM
  • User1521544757 posted

    Multiple Colors wiht LinearGradientBrush - http://thenewboston.org/watch.php?cat=15&number=125 

    Thanks,

    thanks i m alredy use LinearGradientBrush for this link

    http://forums.asp.net/p/1792823/4932151.aspx/1?p=True&t=634699819380264535

    i  not want geadiant color.So i use Solidbrush Multicolors...

    pls help me

    Saturday, April 14, 2012 6:33 AM
  • User1521544757 posted

    The solidBrush only supports 1 color at a time. There is no way to add more than one color.    Maybe you are look for a GradientBrush

     

    http://msdn.microsoft.com/en-us/library/s6fxh562.aspx

     

     

    No, i m using Array in add multi colors

         

    SolidBrush[] brushes = new SolidBrush[] {
            new SolidBrush(Color.Red),
            new SolidBrush(Color.Green),
            new SolidBrush(Color.Blue),
            new SolidBrush(Color.Yellow) };
    
             for (int i = 0; i < brushes.Length; i++)
            {
                g.FillRectangle(brushes1[i], value * 4 - 10, 0, 10, 50);           
            }



    but its display only last index color(Yellow).pls help me sir

    Saturday, April 14, 2012 6:35 AM
  • User-417784260 posted

    Each time you draw the rectangle it over writes the old rectangle because it is bigger.  You should start with the largest rectangle and end with the smallest. 

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, April 14, 2012 7:16 AM
  • User1521544757 posted

    thanks pa

    Saturday, April 14, 2012 9:49 AM