示例#1
0
 private void Per_Click(object sender, EventArgs e)
 {
     if (butlock1 == true && butlock2 == true)
     {
         addnulls();
         Program.Per();
         for (int i = 0; i < Program.Itogo.Count; i++)
         {
             Program.Element el = Program.Itogo[i];
             if (el.chance != 0)
             {
                 listBox7.Items.Add(el.value);
                 listBox8.Items.Add(el.chance);
             }
         }
         Panel1_Paint(Panel1, Program.F, listBox1);
         Panel1_Paint(Panel2, Program.S, listBox4);
         Panel1_Paint(Panel3, Program.Itogo, listBox7);
     }
     else
     {
         string message = "Ты тупой";
         var    result  = MessageBox.Show(message);
     }
 }
示例#2
0
        private void Panel1_Paint(Panel panel, List <Program.Element> L, ListBox B)
        {
            Graphics g = panel.CreateGraphics();

            //Panel1.BackColor = Color.White;
            g.TranslateTransform(20, (panel.Height - 20));
            Pen pen   = new Pen(Color.DarkRed, 0.5f);
            Pen penCO = new Pen(Color.Green, 1f);

            g.DrawLine(penCO, new Point(-5000, 0), new Point(5000, 0));
            g.DrawLine(penCO, new Point(0, -5000), new Point(0, 5000));
            List <Point> p = new List <Point>();

            //Point poss0 = new Point(0, 0);
            //p.Add(poss0);
            //Program.Element el = Program.F[i];
            for (int j = 0; j < Program.U.Count; j++)
            {
                int StepX = (panel.Width - 30) / Program.U.Count;
                int StepY = (panel.Height - 30) / 10;
                int index = B.FindStringExact(Program.U[j]);
                if (index == ListBox.NoMatches)
                {
                    int y = 0;
                    int x = j * StepX;
                    DrawStringY(g, 0, y);     //Посмотрим, что будет дальше, а вообще, надо определять, показывать ноль или один
                    DrawStringX(g, Program.U[j], x);
                    Point poss = new Point(x, y);
                    p.Add(poss);
                }
                else
                {
                    Program.Element el     = L[index];
                    float           floaty = el.chance * -10 * StepY;
                    int             y      = Convert.ToInt32(floaty);
                    int             x      = j * StepX;
                    DrawStringY(g, el.chance, y);
                    DrawStringX(g, Program.U[j], x);
                    Point poss = new Point(x, y);
                    p.Add(poss);
                }
            }

            Point[] parr = p.ToArray();
            g.DrawCurve(pen, parr, 0.0f);
        }
示例#3
0
 private void Dop_Click(object sender, EventArgs e)
 {
     if (butlock1 == true)
     {
         listBox4.Enabled = false;
         listBox3.Enabled = false;
         addnulls();
         Program.Dop();
         for (int i = 0; i < Program.Itogo.Count; i++)
         {
             Program.Element el = Program.Itogo[i];
             listBox7.Items.Add(el.value);
             listBox8.Items.Add(el.chance);
         }
         Panel1_Paint(Panel1, Program.F, listBox1);
         Panel1_Paint(Panel3, Program.Itogo, listBox7);
     }
     else
     {
         string message = "Ты тупой";
         var    result  = MessageBox.Show(message);
     }
 }