//删除某条deadline private void btn_delete_Click(object sender, EventArgs e) { curID = UserItem.GetCurID(); if (curID < 0) { MessageBox.Show("请选择需要删除的Deadline"); return; } if (DialogResult.OK == MessageBox.Show("确定删除选中的DeadLine吗?", "系统提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information)) { for (int i = 0; i < userList.Count; i++) { if (userList[i].UserID == curID) { userList.RemoveAt(i); pannelList.Controls.RemoveAt(i); pannelList.RowCount--; if (pannelList.RowCount == 0) { EmptyItem ei = new EmptyItem(); pannelList.Controls.Clear(); pannelList.Controls.Add(ei); } try { if (!Utils.dbs.DeleteOneItem(TABLENAME, curID)) { MessageBox.Show("删除失败"); } } catch (System.Exception ex) { MessageBox.Show(ex.ToString()); } break; } } } }
//初始化 private void MainForm_Load(object sender, EventArgs e) { //设置窗体初始的位置 double screenX = Screen.GetWorkingArea(this).Width; //得到屏幕整体宽度 this.Left = int.Parse((screenX * 0.75).ToString()); //设置窗体与左边的距离 //double screenY = Screen.GetWorkingArea(this).Height;//得到屏幕整体高度 //this.Top = int.Parse((screenY * 0.1).ToString());//设置窗体与上边的距离 this.Top = 100;//设置窗体与上边的距离 //初始化数据 userList = new List <UserItem>(); countdownList = new List <string>(); countdownID = new List <int>(); fr = null; //得到数据库数据 GetDeadLineData(); if (userList.Count > 0) { userList[0].SetBackColor(0); UserItem.setCurID(userList[0].UserID); } else { EmptyItem ei = new EmptyItem(); pannelList.Controls.Add(ei); } //设置Utils的TOP&LEFT Utils.formTop = this.Top + this.Height / 3; Utils.formLeft = this.Left; Utils.formWidth = this.Width; //显示提醒 timer_showAlert.Start(); }
//初始化 private void MainForm_Load(object sender, EventArgs e) { //设置窗体初始的位置 double screenX = Screen.GetWorkingArea(this).Width;//得到屏幕整体宽度 this.Left = int.Parse((screenX * 0.75).ToString());//设置窗体与左边的距离 //double screenY = Screen.GetWorkingArea(this).Height;//得到屏幕整体高度 //this.Top = int.Parse((screenY * 0.1).ToString());//设置窗体与上边的距离 this.Top = 100;//设置窗体与上边的距离 //初始化数据 userList = new List<UserItem>(); countdownList = new List<string>(); countdownID = new List<int>(); fr = null; //得到数据库数据 GetDeadLineData(); if (userList.Count > 0) { userList[0].SetBackColor(0); UserItem.setCurID(userList[0].UserID); } else { EmptyItem ei = new EmptyItem(); pannelList.Controls.Add(ei); } //设置Utils的TOP&LEFT Utils.formTop = this.Top + this.Height / 3; Utils.formLeft = this.Left; Utils.formWidth = this.Width; //显示提醒 timer_showAlert.Start(); }