Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6607529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:30:47+00:00 2026-05-25T19:30:47+00:00

I want to generate 12 different visible Brush Colors in WPF in my code

  • 0

I want to generate 12 different visible Brush Colors in WPF in my code behind and the number of colors which is initially 12 may vary as the application evolves i.e. I want to generate as many different visible Brush Colors depending on a given count?

I would explain it a little more:

I am creating Rectangles in a for loop and for each rectangle created at run time I have to assign a Fill Color e.g.

    for (i=0; i<12; i++)
    {
        Rectangle rect = new Rectangle();
        rect.Fill = <I want to assign a unique visible color>;
        rect.Stroke = Brushes.Black;
        rect.StrokeThickness = 1;
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T19:30:48+00:00Added an answer on May 25, 2026 at 7:30 pm

    What you probably need is an RGB to HSL, and HSL to RGB converter. You can then divide the total hue (usually represented as degrees in a circle, but sometimes a percent value) by the number of colors required. Incrementing the hue value by the segment amount should produce the most differentiated colors possible.

    Most examples use the WinForms Color object since it was able to provide H S and L values. There are lots of online examples:

    https://web.archive.org/web/20141023005253/http://bobpowell.net/RGBHSB.aspx

    how to use HSL in Asp.net

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to generate a code on n bits for k different inputs that
I want to generate PDF in rails application. I had saw different options for
I want to generate random colours which can be attractive in pie charts.I have
In short: I want to generate two different source trees from the current one,
How can I generate different events from two button columns in gridview? I want
I have 3 textboxes in three different tab control and i want to generate
I want to generate 10 different numbers from a range of 0-9. the desired
I want to be able to generate a different image (with watermark) when the
I have multiple sets of points (for different years ~20) I want to generate
I want to generate a uuid which should be used as unique identifier across

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.