Example #1
0
        ////////////////////////////////右击笔记///////////////////////////////////
        //删除笔记
        private void  除ToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            ListBoxItems listboxitems = listBox.SelectedItem as ListBoxItems;

            new Note().deleteNote(listboxitems.No);
            Load_note_list();
            toolStripStatusLabelTip.Text = "删除成功";
        }
Example #2
0
        private void 收藏ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ListBoxItems listboxitems = listBox.SelectedItem as ListBoxItems;

            if (收藏ToolStripMenuItem.Checked == false)
            {
                new Note().favouriteNote(listboxitems.No);
            }
            else
            {
                new Note().unfavouriteNote(listboxitems.No);
            }
            Load_note_list();
            toolStripStatusLabelTip.Text = "收藏成功";
        }
Example #3
0
        //点击笔记
        public void listBox_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                listBox.SelectedIndex = listBox.IndexFromPoint(e.Location);

                ListBoxItems listboxitems = listBox.SelectedItem as ListBoxItems;
                if (listboxitems != null)
                {
                    //修改收藏是否选中
                    if (listboxitems.Is_favourite == 1)
                    {
                        收藏ToolStripMenuItem.Checked = true;
                    }
                    else
                    {
                        收藏ToolStripMenuItem.Checked = false;
                    }
                }
                else
                {
                }
            }
            if (e.Button == MouseButtons.Left)
            {
                //左击显示列表,显示笔记详情
                ListBoxItems listboxitems = new ListBoxItems();
                listboxitems = this.listBox.SelectedItem as ListBoxItems;
                if (listboxitems != null)
                {
                    MySqlDataReader reader_note_detail = new Note().ShowDetail(listboxitems.No);
                    while (reader_note_detail.Read())
                    {
                        if (reader_note_detail.HasRows)
                        {
                            labelEditNoteNo.Text = reader_note_detail.GetInt32("note_no").ToString();
                            textBoxTitle.Text    = reader_note_detail.GetString("note_name");
                            textBoxEdit.Text     = reader_note_detail.GetString("note_text");
                        }
                    }
                    reader_note_detail.Close();
                }
            }
        }