Exemplo n.º 1
0
        private void lstColors_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (m_InternalValueChange == true)
            {
                return;
            }

            m_InternalValueChange = true;

            // get the selected item and its color
            ColourAndNameListItem item = lstColors.SelectedItem as ColourAndNameListItem;

            // create the HLS and set the data
            ColorManager.HLS hls = ColorManager.RGB_to_HLS(item.Colour);

//			txtH.Value = (int)(hls.H * 100.0);
//			txtL.Value = (int)(hls.L * 100.0);
//			txtS.Value = (int)(hls.S * 100.0);

            // set the preview as well
            previewColorPanel.BackColor = item.Colour;

//			txtRed.Value = previewColorPanel.BackColor.R;
//			txtGreen.Value = previewColorPanel.BackColor.G;
//			txtBlue.Value = previewColorPanel.BackColor.B;

            txtValue.Text = "#" + previewColorPanel.BackColor.R.ToString("X2") + previewColorPanel.BackColor.G.ToString("X2") + previewColorPanel.BackColor.B.ToString("X2");

            m_InternalValueChange = false;
        }
Exemplo n.º 2
0
        private void AddColoursToList(ListBox in_listBox, Type in_colourSource, Color in_selectMe)
        {
            PropertyInfo []       pic;
            ColourAndNameListItem canli;
            int i;

            pic = in_colourSource.GetProperties();

            foreach (PropertyInfo pi in pic)
            {
                if (pi.PropertyType == typeof(Color))
                {
                    canli        = new ColourAndNameListItem();
                    canli.Colour = (Color)pi.GetValue(null, null);
                    canli.Name   = pi.Name;

                    i = in_listBox.Items.Add(canli);

                    if (in_selectMe.Equals(canli.Colour))
                    {
                        in_listBox.SelectedIndex = i;
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void AddColourToList(ListBox in_listBox, Color color)
        {
            ColourAndNameListItem canli = new ColourAndNameListItem();

            canli.Colour = color;
            canli.Name   = color.Name;

            in_listBox.Items.Add(canli);
        }
Exemplo n.º 4
0
		private void AddColourToList(ListBox in_listBox, Color color)
		{
			ColourAndNameListItem canli = new ColourAndNameListItem();
			canli.Colour = color;
			canli.Name = color.Name;

			in_listBox.Items.Add(canli);
		}
Exemplo n.º 5
0
		private void AddColoursToList(ListBox in_listBox, Type in_colourSource, Color in_selectMe)
		{
			PropertyInfo [] pic;
			ColourAndNameListItem canli;			
			int i;

			pic = in_colourSource.GetProperties();

			foreach (PropertyInfo pi in pic)
			{
				if (pi.PropertyType == typeof(Color))
				{
					canli = new ColourAndNameListItem();
					canli.Colour = (Color)pi.GetValue(null, null);
					canli.Name = pi.Name;

					i = in_listBox.Items.Add(canli);

					if (in_selectMe.Equals(canli.Colour))
						in_listBox.SelectedIndex = i;
				}
			}																							
		}