Beispiel #1
0
 private void EditRow_Click(object sender, EventArgs e)
 {
     if (DGVArticles.SelectedRows.Count == 1)
     {
         Data.Model.Article articalForEdit = (Data.Model.Article)DGVArticles.SelectedRows[0].DataBoundItem;
         FrmNewItem         editArticle    = new FrmNewItem(articalForEdit);
         editArticle.ShowDialog();
         DGVArticles.DataSource = new BindingList <Data.Model.Article>(_articalLogic.GetArticleByName(tbSearchItemNo.Text));
         DGVArticles.ClearSelection();
     }
 }
Beispiel #2
0
        private void Right_Click(object sender, EventArgs e)
        {
            MouseEventArgs me = (MouseEventArgs)e;

            if (me.Button == System.Windows.Forms.MouseButtons.Right)
            {
                var hti = DGVArticles.HitTest(me.X, me.Y);
                if (hti.RowIndex >= 0)
                {
                    DGVArticles.ClearSelection();
                    DGVArticles.Rows[hti.RowIndex].Selected = true;
                }

                ContextMenu cm = new ContextMenu();
                cm.MenuItems.Add("Dodaj artikal", new EventHandler(AddNewArtical_Click));
                if (DGVArticles.SelectedRows.Count == 1)
                {
                    cm.MenuItems.Add("Izmeni artikal", new EventHandler(EditRow_Click));
                }
                cm.Show(DGVArticles, new Point(me.X, me.Y));
            }
        }