Exemplo n.º 1
0
        //--------------------------------------------------------------------------------------
        private void toolStripButton2_Click_1(object sender, EventArgs e)
        {
            try
            {
                int     lWishColors  = Convert.ToInt32(tstWishfulColos.Text);
                Color[] lRealColors  = CBlackWhiteExplorer.DefineNeedColor(lWishColors);
                Color[] lFinalColors = CBlackWhiteExplorer.DefineExactNeedColor(lWishColors);
                tstSatisfColor.Text = lRealColors.Length.ToString();
                flpColors.Controls.Clear();
                int lNumberInString = 0;
                for (int i = 0; i < lRealColors.Length; i++)
                {
                    Panel lPanel = new Panel();
                    lPanel.BackColor = lRealColors[i];
                    lPanel.Width     = 50;
                    lPanel.Height    = 50;
                    TextBox lLabel = new TextBox();
                    lLabel.Multiline = true;
                    lLabel.Text      = "R:" +
                                       lRealColors[i].R.ToString("G") + Environment.NewLine + " G:" +
                                       lRealColors[i].G.ToString("G") + Environment.NewLine + " B:" +
                                       lRealColors[i].B.ToString("G");
                    lLabel.Width  = 50;
                    lLabel.Height = 50;
//                    lLabel.AutoSize = true;
                    flpColors.Controls.Add(lLabel);
                    flpColors.Controls.Add(lPanel);
                    lNumberInString += 2;
                    if (lNumberInString == 6)
                    {
                        //                        flpColors.SetFlowBreak(flpColors.Controls[flpColors.Controls.Count - 1]);
                        flpColors.SetFlowBreak(lPanel, true);
                        lNumberInString = 0;
                    }
                }
                lNumberInString = 0;
                flpFinalColors.Controls.Clear();
                for (int i = 0; i < lFinalColors.Length; i++)
                {
                    Panel lPanel = new Panel();
                    lPanel.BackColor = lFinalColors[i];
                    lPanel.Width     = 50;
                    lPanel.Height    = 50;
                    TextBox lLabel = new TextBox();
                    lLabel.Multiline = true;
                    lLabel.Text      = "R:" +
                                       lFinalColors[i].R.ToString("G") + Environment.NewLine + " G:" +
                                       lFinalColors[i].G.ToString("G") + Environment.NewLine + " B:" +
                                       lFinalColors[i].B.ToString("G");
                    lLabel.Width  = 50;
                    lLabel.Height = 50;
                    //                    lLabel.AutoSize = true;
                    flpFinalColors.Controls.Add(lLabel);
                    flpFinalColors.Controls.Add(lPanel);
                    lNumberInString += 2;
                    if (lNumberInString == 6)
                    {
                        //                        flpColors.SetFlowBreak(flpColors.Controls[flpColors.Controls.Count - 1]);
                        flpColors.SetFlowBreak(lPanel, true);
                        lNumberInString = 0;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }