コード例 #1
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            if (!panel1.Controls.Contains(MyUserControl.Instacne))
            {
                panel1.Controls.Add(MyUserControl.Instacne);
                MyUserControl.Instacne.Dock = DockStyle.Fill;
                MyUserControl.Instacne.BringToFront();
            }
            else
            {
                MyUserControl.Instacne.BringToFront();
            }
            Task task = new Task(i, textBox1.Text, ConvertStringToTime(textBox2.Text), 0);

            tasks.Add(task);
            i++;

            //Draw();
            //label1.Text = textBox1.Text;
            for (int i = 0; i < tasks.Count; i++)
            {
                MyUserControl uc = new MyUserControl();
                panel1.Controls.Add(uc);
            }



            textBox1.Clear();
            textBox2.Clear();
        }
コード例 #2
0
        public void Redraw()
        {
            Panel panel = (this.Parent as Panel);
            int   y     = 0;

            panel.Controls.Clear();
            for (int i = 0; i < Form1.tasks.Count; i++)
            {
                MyUserControl uc = new MyUserControl();
                uc.label1.Text          = Form1.tasks[i].name;
                uc.progressBar1.Maximum = Form1.tasks[i].goaltime;
                uc.progressBar1.Value   = Form1.tasks[i].spenttime;
                uc.Location             = new Point(0, y);
                panel.Controls.Add(uc);
                panel.Refresh();
                y += 60;
            }
        }