예제 #1
0
 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == 0)
     {
         DataRowView     dv   = dataGridView1.Rows[e.RowIndex].DataBoundItem as DataRowView;
         var             item = HelperImage.GetByName(dv["Name"].ToString());
         frmLibrary_Edit frm  = new frmLibrary_Edit();
         frm.ItemEdit = item;
         if (frm.ShowDialog() == DialogResult.OK)
         {
             LoadData();
         }
     }
     else if (e.ColumnIndex == 1)
     {
         DataRowView dv = dataGridView1.Rows[e.RowIndex].DataBoundItem as DataRowView;
         if (MessageBox.Show("Do you want delete this item ?", "Delete", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             HelperImage.Delete(dv["Name"].ToString());
             LoadData();
         }
     }
     else if (e.ColumnIndex == 2 || e.ColumnIndex == 3)
     {
         DataRowView dv   = dataGridView1.Rows[e.RowIndex].DataBoundItem as DataRowView;
         var         item = HelperImage.GetByName(dv["Name"].ToString());
         HelperImage.SetItemChange(item);
         this.Close();
     }
 }
예제 #2
0
        private void mnuAdd_Click(object sender, EventArgs e)
        {
            frmLibrary_Edit frm = new frmLibrary_Edit();

            frm.ItemEdit = new HelperImage_Item();
            if (frm.ShowDialog() == DialogResult.OK)
            {
                LoadData();
            }
        }