Exemple #1
0
 private void dataGridViewOrder_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
 {
     if (this.dataGridViewOrder.Columns[e.ColumnIndex].Name == "Food Drink Name")
     {
         if (e.Value != null)
         {
             int ID = Convert.ToInt32(e.Value);
             e.Value             = foodDrinkBLL.GetFoodDrinkName(ID);
             e.FormattingApplied = true;
         }
     }
     if (this.dataGridViewOrder.Columns[e.ColumnIndex].Name == "Unit Price")
     {
         if (e.Value != null)
         {
             double Price = Convert.ToDouble(e.Value);
             e.Value             = Price.ToString("#,#", CultureInfo.InvariantCulture);
             e.FormattingApplied = true;
         }
     }
 }
        public void LoadLegend(SortedDictionary <int, float> totalall)
        {
            FoodDrinkBLL foodDrinkBLL             = new FoodDrinkBLL();
            Dictionary <string, float> lsFoodName = new Dictionary <string, float>();

            foreach (var item in totalall)
            {
                string name = foodDrinkBLL.GetFoodDrinkName(item.Key);
                if (name != null)
                {
                    lsFoodName[name] = item.Value;
                }
            }

            int count = 1;
            int x = 0, y = 0, z = 0;
            int pX = 3, pY = 5;

            foreach (var item in lsFoodName)
            {
                if (count > 5)
                {
                    break;
                }
                Bunifu.Framework.UI.BunifuCheckbox cb1 = new Bunifu.Framework.UI.BunifuCheckbox();

                //Chart1.colorSet.Add(Color.FromArgb(255, 128, 255));
                //Chart1.colorSet.Add(Color.FromArgb(128, 128, 255));
                //Chart1.colorSet.Add(Color.FromArgb(128, 255, 255));
                //Chart1.colorSet.Add(Color.FromArgb(128, 255, 128));
                //Chart1.colorSet.Add(Color.FromArgb(255, 255, 128));
                if (count == 1)
                {
                    //55, 101, 177
                    x = 255; y = 128; z = 255;
                }
                if (count == 2)
                {
                    //87, 151, 255
                    x = 128; y = 128; z = 255;
                }
                if (count == 3)
                {
                    //17, 128, 193
                    x = 201; y = 255; z = 255;
                }
                if (count == 4)
                {
                    //241, 77, 255
                    x = 255; y = 192; z = 128;
                }
                if (count == 5)
                {
                    //148, 38, 131
                    x = 255; y = 255; z = 128;
                }
                count++;
                cb1.BackColor       = Color.FromArgb(x, y, z);
                cb1.CheckedOnColor  = Color.FromArgb(x, y, z);
                cb1.ChechedOffColor = Color.FromArgb(x, y, z);
                cb1.Size            = new Size(20, 20);
                cb1.ForeColor       = Color.FromArgb(x, y, z);
                cb1.Location        = new Point(pX, pY);

                Label lName = new Label();
                lName.Text     = item.Key;
                lName.Location = new Point(pX + 26, pY);



                Label lPercent = new Label();
                lPercent.Text     = item.Value.ToString();
                lPercent.AutoSize = false;
                lPercent.Size     = new Size(80, 23);
                lPercent.Location = new Point(pX + 132, pY);


                panelLegend.Controls.Add(cb1);
                panelLegend.Controls.Add(lName);
                // panelLegend.Controls.Add(lPercent);

                pY += 26;
            }
        }