Author: mycwcgr | Posted on: 5/5/2009 1:53:43 AM | Views : 274

If I locate a known color name such as Blue, I can use btnLocateKnownColor_Click to do it easily!

Now I hope to located any color item, it's btnLocateAnyColor_Click want to do, if the color myAnyColor can not be found in DropDownList1, I hope it can locate a similar color item, how can I do? thanks!

For Exmaple:

myAnyColor = Color.FromArgb(255, 0,0, 255);  //It's blue , locate to Blue item of DropDownList1
myAnyColor = Color.FromArgb(255, 0,0, 254);  //It's similar with blue, and also locate to Blue item of DropDownList1

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
    & ...

Go to the complete details ...