Esempio n. 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            var ret = ProductEditForm.ShowForm(new Products());

            if (ret)
            {
                Msg.ShowInformation("添加成功");
                InitGrid();
            }
        }
Esempio n. 2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            var rows = this.gridView1.GetSelectedRows();

            if (rows.Length == 1)
            {
                var model = (Products)gridView1.GetFocusedRow();
                //Msg.ShowInformation(model.productName);
                var ret = ProductEditForm.ShowForm(model);
                if (ret)
                {
                    Msg.ShowInformation("修改成功");
                    InitGrid();
                }
            }
            else
            {
                Msg.Warning("请选择一条需要修改的数据行");
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 双击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gridView1_MouseDown(object sender, MouseEventArgs e)
        {
            DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hInfo = gridView1.CalcHitInfo(new Point(e.X, e.Y));
            if (e.Button == MouseButtons.Left && e.Clicks == 2)
            {
                //判断光标是否在行范围内
                if (hInfo.InRow)
                {
                    //取得选定行信息
                    // string nodeName = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "nodeName").ToString();

                    var model = (Products)gridView1.GetFocusedRow();
                    var ret   = ProductEditForm.ShowForm(model);
                    if (ret)
                    {
                        Msg.ShowInformation("修改成功");
                    }
                }
            }
        }