Ejemplo n.º 1
0
        private void Item_MouseLeave1(object sender, EventArgs e)
        {
            ItemOne item  = (ItemOne)sender;
            Point   point = item.PointToClient(Control.MousePosition);

            if (point.X <= 0 || point.X >= item.Width || point.Y <= 0 || point.Y >= item.Height)
            {
                item.delete.Visible = false;
            }
        }
Ejemplo n.º 2
0
        private void Item_MouseEnter1(object sender, EventArgs e)
        {
            ItemOne item = (ItemOne)sender;

            if (!beforItem.Equals(item))
            {
                beforItem.delete.Visible = false;
                beforItem = item;
            }
            item.delete.Visible = true;
        }
Ejemplo n.º 3
0
        public void loadWorkPlan(String date)
        {
            if (File.Exists(Program.modelPath + "\\" + date + ".bat"))
            {
                try
                {
                    //读取model
                    FileStream      fs = new FileStream(Program.modelPath + "\\" + date + ".bat", FileMode.Open);
                    BinaryFormatter bf = new BinaryFormatter();
                    workListEntity = bf.Deserialize(fs) as WorkList;
                    fs.Close();
                }
                catch (Exception e) { }
            }
            else
            {
                workListEntity = new WorkList();
            }
            this.date = date;
            todoChecks.Clear();
            finshChecks.Clear();
            Label   nothing = null;
            Control last    = null;

            this.workList.Controls.Clear();
            String[] dates    = date.Split('-');
            DateTime datetime = new DateTime(int.Parse(dates[0]), int.Parse(dates[1]), int.Parse(dates[2]));

            this.workTitle.Text = dates[0] + "年" + dates[1] + "月" + dates[2] + "日 星期" + getWeek(datetime.DayOfWeek) + " 工作安排";

            Label todolabel = new Label();

            todolabel.Location  = new Point(10, 10);
            todolabel.ForeColor = System.Drawing.Color.YellowGreen;
            todolabel.Font      = new System.Drawing.Font("黑体", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            todolabel.Text      = "待完成工作";
            this.workList.Controls.Add(todolabel);



            if (workListEntity.todo.Count == 0)
            {
                nothing           = new Label();
                last              = this.workList.Controls[this.workList.Controls.Count - 1];
                nothing.Location  = new Point(10, last.Location.Y + last.Height + 10);
                nothing.Width     = 450;
                nothing.ForeColor = System.Drawing.Color.Gray;
                nothing.Font      = new System.Drawing.Font("黑体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
                nothing.Text      = "目前没有工作安排";
                nothing.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
                nothing.AutoSize  = false;
                this.workList.Controls.Add(nothing);
            }
            else
            {
                for (int i = 0; i < workListEntity.todo.Count; i++)
                {
                    ItemOne item = new ItemOne(workListEntity.todo[i].id);
                    item.workText.Text = workListEntity.todo[i].content;
                    item.CheckChange  += Item_CheckChange;
                    if (this.workList.Controls.Count >= 1)
                    {
                        last          = this.workList.Controls[this.workList.Controls.Count - 1];
                        item.Location = new Point(0, last.Location.Y + last.Height);
                    }
                    item.ID             = i + "";
                    item.finish.Visible = false;
                    item.delete.Visible = false;
                    item.edit.Visible   = false;
                    item.MouseEnter    += Item_MouseEnter;
                    item.MouseLeave    += Item_MouseLeave;
                    item.DeleteWork    += Item_DeleteWork;
                    item.FinishWork    += Item_FinishWork;
                    item.EditWork      += Item_EditWork;
                    this.workList.Controls.Add(item);
                }
            }

            Label finishlabel = new Label();

            last = this.workList.Controls[this.workList.Controls.Count - 1];
            finishlabel.Location  = new Point(10, last.Location.Y + last.Height + 30);
            finishlabel.ForeColor = System.Drawing.Color.ForestGreen;
            finishlabel.Font      = new System.Drawing.Font("黑体", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            finishlabel.Text      = "已完成工作";
            this.workList.Controls.Add(finishlabel);


            if (workListEntity.finsh.Count == 0)
            {
                nothing           = new Label();
                last              = this.workList.Controls[this.workList.Controls.Count - 1];
                nothing.Location  = new Point(10, last.Location.Y + last.Height + 10);
                nothing.Width     = 450;
                nothing.ForeColor = System.Drawing.Color.Gray;
                nothing.Font      = new System.Drawing.Font("黑体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
                nothing.Text      = "还没有完成任何工作哦";
                nothing.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
                nothing.AutoSize  = false;
                this.workList.Controls.Add(nothing);
            }
            else
            {
                for (int i = 0; i < workListEntity.finsh.Count; i++)
                {
                    ItemOne item = new ItemOne(workListEntity.finsh[i].id);
                    item.workText.Text = workListEntity.finsh[i].content;
                    item.CheckChange  += Item_CheckChange1;
                    if (this.workList.Controls.Count >= 1)
                    {
                        last          = this.workList.Controls[this.workList.Controls.Count - 1];
                        item.Location = new Point(0, last.Location.Y + last.Height);
                    }
                    item.ID             = i + "";
                    item.finish.Visible = false;
                    item.delete.Visible = false;
                    item.edit.Visible   = false;
                    item.MouseEnter    += Item_MouseEnter1;
                    item.MouseLeave    += Item_MouseLeave1;
                    item.DeleteWork    += Item_DeleteWork1;
                    this.workList.Controls.Add(item);
                }
            }
        }