/// <summary> /// 用户点击gridUserInfo行事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gridUserInfo_Click(object sender, EventArgs e) { DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hi = this.ViewUserInfo.CalcHitInfo(((Control)sender).PointToClient(Control.MousePosition)); if (this.ViewUserInfo != null && this.ViewUserInfo.FocusedRowHandle >= 0 && hi.RowHandle >= 0) { m_cutRow = this.ViewUserInfo.FocusedRowHandle; if (m_cutRow < 0) { return; } DataRow dw = ViewUserInfo.GetDataRow(m_cutRow); int userID = int.Parse(dw["UserID"].ToString()); InitAccountListByUserID(userID, 0); } }
private void ShowHitInfo(DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hi) { try { if (hi.HitTest != DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitTest.RowCell) { return; } SendForm(); return; } catch (Exception ex) { Basic.ShowMessage(3, ex.Message); } }
private void grdLoadingSheet_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { // 获取鼠标拖放位置 Point point = new Point(e.X, e.Y); DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hi = grdvLoadingSheet.CalcHitInfo(point); if (hi.RowHandle >= 0 && hi.RowHandle < loadingSheet.Count) { grdvLoadingSheet.FocusedRowHandle = hi.RowHandle; int index = grdvLoadingSheet.GetFocusedDataSourceRowIndex(); grdLoadingSheet.DoDragDrop(loadingSheet[index], DragDropEffects.Copy); } } }
/// <summary> /// 表格单击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gridCenter_Click(object sender, EventArgs e) { DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hi = this.ViewMachine.CalcHitInfo(((Control)sender).PointToClient(Control.MousePosition)); if (this.ViewMachine != null && this.ViewMachine.FocusedRowHandle >= 0 && hi.RowHandle >= 0) { m_cutRow = this.ViewMachine.FocusedRowHandle; DataRow dw = ViewMachine.GetDataRow(m_cutRow); int MatchMachineID = int.Parse(dw["MatchMachineID"].ToString()); MatchMachine = MatchMachineBLL.GetModel(MatchMachineID); SetMatchMachine(MatchMachine); } //else //{ // ShowMessageBox.ShowInformation("请选中记录行"); //} }
private void gvPODetails_DoubleClick(object sender, EventArgs e) { DevExpress.Utils.DXMouseEventArgs ea = e as DevExpress.Utils.DXMouseEventArgs; DevExpress.XtraGrid.Views.Grid.GridView view = sender as DevExpress.XtraGrid.Views.Grid.GridView; DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo info = view.CalcHitInfo(ea.Location); if (info.InRow || info.InRowCell) { frmReceiveStock frm = new frmReceiveStock((DataRow)view.GetDataRow(info.RowHandle)); frm.StartPosition = FormStartPosition.CenterParent; if (frm.ShowDialog() == DialogResult.OK) { PurchaseOrderToGRV grv = (PurchaseOrderToGRV)purchaseOrderToGRVBindingSource.DataSource; grv.Reload(); gcPOHeader.DataSource = grv.HeaderInfo; gcPODetails.DataSource = grv.DetailInfo; } } }
private void gridView名称代码_MouseDown(object sender, MouseEventArgs e) { DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hInfo = gridView名称代码.CalcHitInfo(new Point(e.X, e.Y)); if (e.Button == MouseButtons.Left && e.Clicks == 2) { //判断光标是否在行范围内 if (hInfo.InRow) { result.FCLASSAREA2 = gridView名称代码.GetRowCellValue(gridView名称代码.FocusedRowHandle, "FCLASSAREA2").ToString(); result.FNAME = gridView名称代码.GetRowCellValue(gridView名称代码.FocusedRowHandle, "FNAME").ToString(); result.FID = gridView名称代码.GetRowCellValue(gridView名称代码.FocusedRowHandle, "FID").ToString(); result.FCODE = gridView名称代码.GetRowCellValue(gridView名称代码.FocusedRowHandle, "FCODE").ToString(); this.DialogResult = DialogResult.OK; this.Close(); } } }
private void gvCompany_DoubleClick(object sender, EventArgs e) { GridView view = (GridView)sender; Point pt = view.GridControl.PointToClient(Control.MousePosition); DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo info = view.CalcHitInfo(pt); if (info.InRow || info.InRowCell) { DataTable dtCP = (DataTable)gcCompany.DataSource; if (dtCP.Rows.Count > 0) { lblStatus.Text = "* Edit Company"; lblStatus.ForeColor = Color.Red; DataRow drCP = dtCP.Rows[info.RowHandle]; txeID.Text = drCP["ID"].ToString(); txeCode.Text = drCP["Company Code"].ToString(); txeName.Text = drCP["Company Name"].ToString(); txeAddr1.Text = drCP["Address1"].ToString(); txeAddr2.Text = drCP["Address2"].ToString(); txeAddr3.Text = drCP["Address3"].ToString(); txeNameTH.Text = drCP["ชื่อบริษัท"].ToString(); txeAddr1TH.Text = drCP["ที่อยู่1"].ToString(); txeAddr2TH.Text = drCP["ที่อยู่2"].ToString(); txeAddr3TH.Text = drCP["ที่อยู่3"].ToString(); txeTel.Text = drCP["Telephone"].ToString(); txeFax.Text = drCP["Fax."].ToString(); txeTax.Text = drCP["Tax ID."].ToString(); txeBranchNo.Text = drCP["Branch No."].ToString(); txeTelTH.Text = txeTel.Text; txeFaxTH.Text = txeFax.Text; txeTaxTH.Text = txeTax.Text; txeBranchNoTH.Text = txeBranchNo.Text; rgStatus.EditValue = Convert.ToInt32(drCP["State"].ToString()); txeCREATE.Text = drCP["CreatedBy"].ToString(); txeCDATE.Text = drCP["CreatedDate"].ToString(); } } }
private void gridControl1_DoubleClick(object sender, EventArgs e) { DevExpress.XtraGrid.Views.Grid.GridView obj = gridControl1.MainView as DevExpress.XtraGrid.Views.Grid.GridView; DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hi = obj.CalcHitInfo(gridControl1.PointToClient(Cursor.Position)); // valid info? if (!(hi.IsValid && hi.InRowCell)) { return; } // is symbol (symbol or axis) column? if (!(obj.FocusedColumn.FieldName == "SYMBOLNAME" || obj.FocusedColumn.FieldName == "XAXIS" || obj.FocusedColumn.FieldName == "YAXIS" || obj.FocusedColumn.FieldName == "XAXISADDRESS" || obj.FocusedColumn.FieldName == "YAXISADDRESS")) { return; } // check for null ref. if (obj.FocusedValue == null || string.IsNullOrEmpty(obj.FocusedValue.ToString())) { return; } if (onStartSymbolViewer != null && obj.FocusedColumn.FieldName == "SYMBOLNAME") { onStartSymbolViewer(this, new SymbolViewerRequestedEventArgs(obj.FocusedValue.ToString().Trim())); } else if (onStartAxisViewer != null && (obj.FocusedColumn.FieldName == "XAXISADDRESS" || obj.FocusedColumn.FieldName == "XAXIS")) { object odata = gridView1.GetRowCellValue(hi.RowHandle, "XAXISADDRESS"); if (odata != null) { onStartAxisViewer(this, new AxisViewerRequestedEventArgs(odata.ToString())); } } else if (onStartAxisViewer != null && (obj.FocusedColumn.FieldName == "YAXISADDRESS" || obj.FocusedColumn.FieldName == "YAXIS")) { object odata = gridView1.GetRowCellValue(hi.RowHandle, "YAXISADDRESS"); if (odata != null) { onStartAxisViewer(this, new AxisViewerRequestedEventArgs(odata.ToString())); } } }
/// <summary> /// 表格双击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gridFund_DoubleClick(object sender, EventArgs e) { DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hi = this.ViewFund.CalcHitInfo(((Control)sender).PointToClient(Control.MousePosition)); if (this.ViewFund != null && this.ViewFund.FocusedRowHandle >= 0 && hi.RowHandle >= 0) { m_cutRow = this.ViewFund.FocusedRowHandle; AddFundForm AddFundForm = new AddFundForm(); DataRow dw = ViewFund.GetDataRow(m_cutRow); int UserID = int.Parse(dw["UserID"].ToString()); AddFundForm.UserID = UserID; if (AddFundForm.ShowDialog() == DialogResult.OK) { Init(); } } }
private void gridControl1_DoubleClick(object sender, EventArgs e) { DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hi = gridView1.CalcHitInfo((sender as System.Windows.Forms.Control).PointToClient(System.Windows.Forms.Control.MousePosition)); DataRow FocusRow; if (hi.RowHandle >= 0) { FocusRow = gridView1.GetDataRow(hi.RowHandle); ACMS.ACMSStaff.WorkFlow.MyCustomEditForm frm = new ACMS.ACMSStaff.WorkFlow.MyCustomEditForm((int)FocusRow.ItemArray[0], nDepartment); frm.Show(); } else if (gridView5.FocusedRowHandle >= 0) { FocusRow = gridView1.GetDataRow(gridView5.FocusedRowHandle); ACMS.ACMSStaff.WorkFlow.MyCustomEditForm frm = new ACMS.ACMSStaff.WorkFlow.MyCustomEditForm((int)FocusRow.ItemArray[0], nDepartment); frm.Show(); } }
/// <summary> /// 双击修改 /// </summary> private void gvData_MouseDown(object sender, MouseEventArgs e) { DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo viewInfo = gvData.CalcHitInfo(new Point(e.X, e.Y)); if (e.Clicks == 2 && e.Button == MouseButtons.Left) { if (viewInfo.InRow) { if (!(bool)gvData.GetFocusedRowCellValue("IsFinish")) { Guid ID = clsPublic.GetObjGUID(gvData.GetFocusedRowCellValue("Id")); AssetsRepairFinishForm sub = new AssetsRepairFinishForm(ID); if (sub.ShowDialog() == DialogResult.OK) { Query(); } } } } }
private void simpleButton1_Click_1(object sender, EventArgs e) { DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hi = gridView1.CalcHitInfo((sender as System.Windows.Forms.Control).PointToClient(System.Windows.Forms.Control.MousePosition)); DataRow FocusRow; if (hi.RowHandle >= 0) { FocusRow = gridView1.GetDataRow(hi.RowHandle); int nAttachment = System.Convert.ToInt32(FocusRow.ItemArray[0]); this.tblAttachmentTableAdapter.DeleteQuery(nAttachment); } else if (gridView1.FocusedRowHandle >= 0) { FocusRow = gridView1.GetDataRow(gridView1.FocusedRowHandle); int nAttachment = System.Convert.ToInt32(FocusRow.ItemArray[0]); this.tblAttachmentTableAdapter.DeleteQuery(nAttachment); } this.tblAttachmentTableAdapter.Fill(this.aCMSDataSet5.tblAttachment, nUniqueID); }
/// <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("修改成功"); } } } }
private void gv_patients_MouseDown(object sender, MouseEventArgs e) { //鼠标右键点击 System.Threading.Thread.Sleep(10); if (e.Button == MouseButtons.Right) { //GridHitInfo gridHitInfo = gridView.CalcHitInfo(e.X, e.Y); DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo gridHitInfo = gv_Patients.CalcHitInfo(e.X, e.Y); //在列标题栏内且列标题name是"colName" if (gridHitInfo.Column != null) { if (!gridHitInfo.InColumnPanel)//判断是否在单元格内 { contextMenuStrip1.Show(gc_Patients, e.Location); int i = gridHitInfo.RowHandle; } } } }
private void gridView_MouseMove(object sender, MouseEventArgs e) { DevExpress.XtraGrid.Views.Grid.GridView view = sender as DevExpress.XtraGrid.Views.Grid.GridView; if (view != null) { Point point = new Point(e.X, e.Y); DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo info = view.CalcHitInfo(point); foreach (var controller in this.buttonCells.Values) { if (info.InRowCell && IsMouseOverButton(info.RowHandle, controller.ColumnName, point)) { controller.HighlightedRowHandle = info.RowHandle; } else { controller.HighlightedRowHandle = GridControl.InvalidRowHandle; } } } }
/// <summary> /// 删除按纽事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_Del_Click(object sender, EventArgs e) { try { if (ShowMessageBox.ShowQuestion("确认删除吗?") == DialogResult.No) { return; } DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hi = this.ViewCenter.CalcHitInfo(((Control)sender).PointToClient(Control.MousePosition)); if (this.ViewCenter != null && this.ViewCenter.FocusedRowHandle >= 0) { m_cutRow = this.ViewCenter.FocusedRowHandle; DataRow dw = ViewCenter.GetDataRow(m_cutRow); int MatchCenterID = int.Parse(dw["MatchCenterID"].ToString()); ManagementCenter.BLL.RC_MatchMachineBLL _MatchMachineBLL = new RC_MatchMachineBLL(); DataSet ds = _MatchMachineBLL.GetList(string.Format("MatchCenterID={0}", MatchCenterID)); if (ds != null && ds.Tables[0].Rows.Count > 0) { ShowMessageBox.ShowInformation("该中心下存在撮合机,不允许删除!"); return; } MatchCenterBLL.Delete(MatchCenterID); ShowMessageBox.ShowInformation("删除成功!"); SetTextValue(null); SetControlEnAbled(); LoadCenterList(); } } catch (Exception ex) { ShowMessageBox.ShowInformation("删除失败!"); string errCode = "GL-2002"; string errMsg = "删除失败"; VTException vte = new VTException(errCode, errMsg, ex); LogHelper.WriteError(vte.ToString(), vte.InnerException); } SetTextValue(null); SetControlEnAbled(); }
private void gridView请购计划列表_MouseDown(object sender, MouseEventArgs e) { DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hInfo = gridView请购计划列表.CalcHitInfo(new Point(e.X, e.Y)); if (e.Button == MouseButtons.Left && e.Clicks == 2) { //判断光标是否在行范围内 if (hInfo.InRow) { if (gridView请购计划列表.FocusedRowHandle > -1) { var list = gridView请购计划列表.DataSource as V_ICPRBILLMODEL[]; var icprbilldata = list[gridView请购计划列表.GetDataSourceRowIndex(gridView请购计划列表.FocusedRowHandle)]; frm请购计划编辑 frm = new frm请购计划编辑(icprbilldata.FID); frm.ICPRBILLData = icprbilldata; frm.SaveAfter += Frm_SaveAfter; frm.Show(); } } } }
private void GRD_KULLANICI_ANAMENU_LISTE_Click(object sender, EventArgs e) { DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hi = gridView_KULLANICI_ANAMENU.CalcHitInfo((sender as Control).PointToClient(Control.MousePosition)); DataRow dr = gridView_KULLANICI_ANAMENU.GetDataRow(hi.RowHandle); if (dr != null) { _AnaMenuID = dr["MENU_KODU"].ToString(); using (SqlConnection MySqlConnection = new SqlConnection(_GLOBAL_PARAMETERS._CONNECTIONSTRING_MDB.ToString())) { SqlDataAdapter MySqlDataAdapter = new SqlDataAdapter(String.Format(" SELECT * FROM ADM_KULLANICI_MENU_LISTESI WHERE (MAIL_ADRESI = '{0}' and MENU_GROUP='{1}')", dr["MAIL_ADRESI"], dr["MENU_KODU"]), MySqlConnection); using (DataSet MyDataSet = new DataSet()) { MySqlDataAdapter.Fill(MyDataSet, "dbo_USER"); DataViewManager dvManager = new DataViewManager(MyDataSet); DataView dv = dvManager.CreateDataView(MyDataSet.Tables[0]); GRD_KULLANICI_ALTMENU_LISTE.DataSource = dv; } } } }
/// <summary> /// 그리드 더블클릭 /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param> private void Grid_MouseDoubleClick(object sender, MouseEventArgs e) { try { this.txtHoli.Text = ""; this.txtHoli.Tag = null; DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hi = (((GridView)((GridControl)sender).Views[0]).CalcHitInfo(new Point(e.X, e.Y))); int iRow = hi.RowHandle; if (iRow < 0) { return; } if (((DataTable)(((GridControl)sender).DataSource) == null || ((DataTable)((GridControl)sender).DataSource).Rows.Count <= 0)) { return; } GrdInfo info = GetFocusGridIndex(sender); if (!info.IsValue) { return; } int XX = ((GridControl)sender).Location.X; int YY = ((GridControl)sender).Location.Y; int X = 15 + 28 * ((GridView)((GridControl)sender).Views[0]).FocusedColumn.ColumnHandle; int Y = 30 + 20 * ((GridView)((GridControl)sender).Views[0]).FocusedRowHandle; ShowHoliDay(info, new System.Drawing.Point(X + XX, Y + YY)); } catch (Exception ex) { Basic.ShowMessage(3, ex.Message); } }
private void grid_stocks_DoubleClick(object sender, EventArgs e) { DataRow dr1 = null; DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hi = gridView1.CalcHitInfo((grid_stocks as Control).PointToClient(Control.MousePosition)); if (hi.RowHandle >= 0) { dr1 = gridView1.GetDataRow(hi.RowHandle); } else if (gridView1.FocusedRowHandle >= 0) { dr1 = gridView1.GetDataRow(gridView1.FocusedRowHandle); } else { dr1 = null; } if (dr1 != null) { _stockCode = dr1["STOK_KODU"].ToString(); _stokCodeMove = _stockCode; _variation = Convert.ToInt32(dr1["VARYASYON_KODU"]); _variationMove = _variation; _id = Convert.ToInt32(dr1["ID"]); // id2 = Convert.ToInt32(dr1["ID2"]); } string a = _stockCode + _variation.ToString(); FetchData(_stockCode, _variation); grid_stockList.Visible = false; btn_imageadd.Enabled = true; btn_imageremove.Enabled = true; xtraTabControl1.Visible = true; }
private void gridView1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left && e.Clicks == 2) { DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo ghi = gridView1.CalcHitInfo(new Point(e.X, e.Y)); if (!ghi.InRow) // 判断光标是否在行内 { return; } string zt = gridView1.GetRowCellDisplayText(gridView1.FocusedRowHandle, "状态"); // string zt = view.GetRowCellValue(e.RowHandle, "状态").ToString(); if (zt == "未校核") { return; } DialogResult dlr = MessageBox.Show("是否撤销校核?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (dlr == DialogResult.No) { return; } string id = gridView1.GetFocusedRowCellValue("ID").ToString(); List <string> param = new List <string>(); param.Add("p_id:" + id); param.Add("p_djh:" + rqh); service.ExecuteReturnInt(this.GetType().ToString(), "CancelJH", param.ToArray(), out errMsg); if (!string.IsNullOrEmpty(errMsg)) { MessageBox.Show(errMsg); } gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns["状态"], "未校核"); gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns["破损"], "正常"); txtIsbn.Focus(); txtIsbn.SelectAll(); } }
private void gridControl3_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { GridControl gv = sender as GridControl; DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hi = gv.FocusedView.CalcHitInfo(e.Location) as DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo; if (e.Button == MouseButtons.Right) { if (hi.InRow) { this.barButtonItem1.Enabled = true; //this.barButtonItem2.Enabled = true; this.btnDataErr.Enabled = true; } else { this.barButtonItem1.Enabled = false; //this.barButtonItem2.Enabled = false; this.btnDataErr.Enabled = false; } this.popupMenu1.ShowPopup(Control.MousePosition); } }
private void gridView1_DoubleClick(object sender, EventArgs e) { DevExpress.Utils.DXMouseEventArgs ea = e as DevExpress.Utils.DXMouseEventArgs; DevExpress.XtraGrid.Views.Grid.GridView view = sender as DevExpress.XtraGrid.Views.Grid.GridView; DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo info = view.CalcHitInfo(ea.Location); if (info.InRowCell) { int Id = Convert.ToInt32(gridView1.GetRowCellValue(gridView1.GetSelectedRows()[0], gridView1.Columns["Id"]).ToString()); Trademark tm = tempRecList.Where(i => i.Id == Id).First(); string url = tm.getUrl(); if (url.Trim() != "") { System.Diagnostics.Process.Start(url); } else { MessageBox.Show("Δεν υπάρχει καταχωρημένο Url για τη συγκεκριμένη εγγραφή!"); } } }
private void gridView请购计划列表_MouseDown(object sender, MouseEventArgs e) { DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hInfo = gridView采购订单列表.CalcHitInfo(new Point(e.X, e.Y)); if (e.Button == MouseButtons.Left && e.Clicks == 2) { //判断光标是否在行范围内 if (hInfo.InRow) { if (gridView采购订单列表.FocusedRowHandle > -1) { var list = gridView采购订单列表.DataSource as V_ICPOBILLMODEL[]; var icprbilldata = list[gridView采购订单列表.GetDataSourceRowIndex(gridView采购订单列表.FocusedRowHandle)]; if (icprbilldata.FSTATUS != 1 && icprbilldata.FSTATUS != 4 && icprbilldata.FSTATUS != 0 && !(icprbilldata.FSTATUS == 3 && icprbilldata.FSYNCSTATUS == 4)) { MsgHelper.ShowInformation("当前状态不支持修改!"); return; } bool bzf = false; if (icprbilldata.FSYNCSTATUS == 4 || icprbilldata.FSTATUS == 3) { bzf = true; } FrmPurchaseOrder frm = new FrmPurchaseOrder(icprbilldata, bzf); if (bzf) { frm.Text = "采购订单作废"; } else { frm.Text = "采购订单修改"; } frm.SaveAfter += Frm_SaveAfter; frm.Show(); } } } }
private void grdView_Click(object sender, EventArgs e) { Point p = grdView.GridControl.PointToClient(MousePosition); DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo info = grdView.CalcHitInfo(p); if (info.HitTest == DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitTest.Column && info.Column.OptionsColumn.AllowSort == DevExpress.Utils.DefaultBoolean.True) { if (sortBy == info.Column.FieldName) { sortAsc = !sortAsc; } else { sortAsc = true; } sortBy = info.Column.FieldName; loadedCount = 0; GetCustomerResultList(txtKeyboardInput.Text, loadedCount, maxRowsAtEachQuery, sortBy, sortAsc, false); loadedCount = maxRowsAtEachQuery; grCustomers.DataSource = this.customerResultList; foreach (DevExpress.XtraGrid.Columns.GridColumn col in grdView.Columns) { col.SortOrder = DevExpress.Data.ColumnSortOrder.None; } grdView.Columns[sortBy].SortOrder = sortAsc ? DevExpress.Data.ColumnSortOrder.Ascending : DevExpress.Data.ColumnSortOrder.Descending; } CheckRowPosition(); txtKeyboardInput.Select(); }
/// <summary> ///修改 期货交易规则UI的GridView双击事件 gdFuturesTradeRulesResult_DoubleClick /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gdFuturesTradeRulesResult_DoubleClick(object sender, EventArgs e) { try { DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hi = this.gdvFuturesTradeRulesSelect.CalcHitInfo(((Control)sender).PointToClient(Control.MousePosition)); if (this.gdvFuturesTradeRulesSelect != null && this.gdvFuturesTradeRulesSelect.FocusedRowHandle >= 0 && hi.RowHandle >= 0) { m_CurRow = this.gdvFuturesTradeRulesSelect.FocusedRowHandle; UpdateFuturesTradeRules(m_CurRow); } //else //{ // ShowMessageBox.ShowInformation("请选中记录行!"); //} } catch { return; } }
/// <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) { int selectedHandle; selectedHandle = this.gridView1.GetSelectedRows()[0]; //this.gridView1.GetRowCellValue(selectedHandle, "id").ToString(); for (int i = AddressTypeRuleList.Rows.Count - 1; i >= 0; i--) { if (this.gridView1.GetRowCellValue(selectedHandle, "ID") != null) { if (AddressTypeRuleList.Rows[i]["ID"].ToString() == this.gridView1.GetRowCellValue(selectedHandle, "ID").ToString()) { AddressTypeRuleList.Rows.RemoveAt(i); } } } } } }
/// <summary> /// 修改(商品)期货_持仓限制GridView双击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gdPositionLimitValueResult_DoubleClick(object sender, EventArgs e) { try { DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hi = this.gdPositionLimitValueSelect.CalcHitInfo(((Control)sender).PointToClient(Control.MousePosition)); if (this.gdPositionLimitValueSelect != null && this.gdPositionLimitValueSelect.FocusedRowHandle >= 0 && hi.RowHandle >= 0) { m_CurRow = this.gdPositionLimitValueSelect.FocusedRowHandle; this.UpdateQHPositionLimitValue(m_CurRow); } else { ShowMessageBox.ShowInformation("请选中记录行!"); } } catch (Exception ex) { LogHelper.WriteError(ex.Message, ex); return; } }
void gridView2_DoubleClick(object sender, EventArgs e) { DevExpress.XtraGrid.Views.Grid.GridView gv = sender as DevExpress.XtraGrid.Views.Grid.GridView; Point pt = gv.GridControl.PointToClient(MousePosition); DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo vi = gv.CalcHitInfo(pt); if (vi.InRowCell || vi.InRow) { var selecteddatarow = (BMS_DAL.DS.BMSDS.TFixturesRow)((DataRowView)this.bindingSource1.Current).Row; var datarowitem = (BMS_DAL.DS.BMSDS.TInvoicesRow)gv.GetDataRow(vi.RowHandle); datarowitem.OPER = BMS_Component.UserInfo.UserName; datarowitem.OP_DT = DateTime.Now; InvoiceItem item = new InvoiceItem(); item.Text = "Update Invoice"; item.FixDataRow = selecteddatarow; item.DataRowItem = datarowitem; item.InvoiceDetailDV = _ds.TInvoiceDetails.DefaultView; item.InvoiceDetailDV.RowFilter = string.Format("INVOICE_ID='{0}'", datarowitem.ID); switch (item.ShowDialog()) { case DialogResult.OK: MessageBox.Show(string.Format("Update {0} rows", this._daservice.UpdateFixtureWithRelation(_ds))); this._ds.TFixtures.Clear(); this._ds.TInvoices.Clear(); this._ds.TInvoiceDetails.Clear(); this._ds.Merge(_daservice.GetFixtureWithRelation()); this.BindData1(); this.BindData2(); break; case DialogResult.Cancel: this._ds.RejectChanges(); break; } } }
private void grdUsers_DoubleClick(object sender, EventArgs e) { DevExpress.Utils.DXMouseEventArgs ea = e as DevExpress.Utils.DXMouseEventArgs; DevExpress.XtraGrid.GridControl cntrl = (DevExpress.XtraGrid.GridControl)sender; DevExpress.XtraGrid.Views.Grid.GridView view = (DevExpress.XtraGrid.Views.Grid.GridView)cntrl.MainView; if (view == null) { return; } DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo info = view.CalcHitInfo(ea.Location); if (info.InRow || info.InRowCell) { try { DataRow dr = vwUsers.GetDataRow(view.GetSelectedRows()[0]); LoadUser(new User(dr.Field <int>("AutoIndex"))); } catch (Exception) { MessageBox.Show($"Error: {e.ToString()}"); } } }
private void gridControl1_MouseMove(object sender, MouseEventArgs e) { gvhi = gridViewSymbols.CalcHitInfo(new Point(e.X, e.Y)); }
private void gc_Routing_DragDrop(object sender, DragEventArgs e) { DataRow oldrow = e.Data.GetData(typeof(DataRow)) as DataRow; Point p = PointToClient(new Point(e.X, e.Y)); Point tabp = this.tabControl1.Location; Point gcp = this.gc_Routing.Location; Point Top = new Point((p.X - tabp.X - gcp.X), (p.Y - tabp.Y - gcp.Y - 24)); downHitInfo2 = gv_Routing.CalcHitInfo(Top); // MessageBox.Show(Top.ToString()); DataRow newrow = gv_Routing.GetDataRow(downHitInfo2.RowHandle); //MessageBox.Show(data["dRoutingNo"].ToString()); // row["dRoutingNo"]=0; int OldPos = Convert.ToInt32(oldrow["dRoutingNo"]); int NewPos = Convert.ToInt32(newrow["dRoutingNo"]); //下向上移时 if (OldPos > NewPos) { oldrow["dRoutingNo"] = 0; foreach (DataRow item in this.DTRouting.Rows) { // MessageBox.Show(item["sMachine"].ToString()); if (Convert.ToInt32(item["dRoutingNo"]) >= NewPos) { item["dRoutingNo"] = Convert.ToInt32(item["dRoutingNo"])*10+1; } } oldrow["dRoutingNo"] = NewPos * 10; //因为是批量更新,所以表主键不可以重复 if (DTRouting.GetChanges() != null) { ZX.ZXSystem.DBUtility.DbHelperSQL.UpdateTable(DTRouting.GetChanges(), "PP_Routing"); } string strSql4 = "select * from PP_Routing where sWO='" + oldrow["sWO"] + "' order by dRoutingNo"; DTRouting = ZX.ZXSystem.DBUtility.DbHelperSQL.Query(strSql4).Tables[0]; } //上向下移时 if (OldPos < NewPos) { oldrow["dRoutingNo"] = 0; foreach (DataRow item in this.DTRouting.Rows) { // MessageBox.Show(item["sMachine"].ToString()); if (Convert.ToInt32(item["dRoutingNo"]) >NewPos) { item["dRoutingNo"] = Convert.ToInt32(item["dRoutingNo"]) * 10 + 1; } } oldrow["dRoutingNo"] = NewPos*10; //因为是批量更新,所以表主键不可以重复 if (DTRouting.GetChanges() != null) { ZX.ZXSystem.DBUtility.DbHelperSQL.UpdateTable(DTRouting.GetChanges(), "PP_Routing"); } string strSql4 = "select * from PP_Routing where sWO='" + oldrow["sWO"] + "' order by dRoutingNo"; DTRouting = ZX.ZXSystem.DBUtility.DbHelperSQL.Query(strSql4).Tables[0]; } RoutingReOrder(); // LoadData(FP.pub_Object.ToString()); string sWO = (string)this.gv_WorkOrder.GetFocusedRowCellValue(this.gv_WorkOrder.Columns.ColumnByFieldName("sWO")); if (sWO != "") { string strSql4 = "select * from PP_Routing where sWO='" + sWO + "' order by dRoutingNo"; DTRouting = ZX.ZXSystem.DBUtility.DbHelperSQL.Query(strSql4).Tables[0]; gc_Routing.DataSource = DTRouting; } }
private void gc_Routing_MouseDown(object sender, MouseEventArgs e) { // MessageBox.Show("MouseDown:"+e.X + ":" + e.Y); downHitInfo = gv_Routing.CalcHitInfo(new Point(e.X, e.Y)); }
private void gview_MouseMove(object sender, MouseEventArgs e) { try { var view = (GridView)sender; if (this.downHit == null || downHit.RowHandle < 0 || e.Button != MouseButtons.Left || view.ActiveEditor != null || ModifierKeys != Keys.None) return; if (this.currentChannelList == null || this.currentChannelList.ReadOnly) return; // drag/drop only allowed when left grid is sorted by NewSlotNr if (!this.IsLeftGridSortedByNewProgNr) return; if (Math.Abs(e.Y - downHit.HitPoint.Y) < SystemInformation.DragSize.Height && Math.Abs(e.X - downHit.HitPoint.X) < SystemInformation.DragSize.Width) return; // start drag operation var channel = (ChannelInfo)view.GetRow(downHit.RowHandle); this.dragDropInfo = new DragDropInfo(view, channel.GetPosition(this.subListIndex)); view.GridControl.DoDragDrop(this.dragDropInfo, DragDropEffects.Move); this.downHit = null; } catch (Exception ex) { HandleException(ex); } }
// these 4 event handler in combination override the default row-selection and editor-opening // behavior of the grid control. private void gview_MouseDown(object sender, MouseEventArgs e) { GridView view = (GridView)sender; this.downHit = view.CalcHitInfo(e.Location); this.dragDropInfo = null; if (!view.IsDataRow(downHit.RowHandle)) return; if (e.Button == MouseButtons.Left) { if (ModifierKeys == Keys.None) { if (downHit.RowHandle != view.FocusedRowHandle) SelectFocusedRow(view, downHit.RowHandle); this.timerEditDelay.Start(); } else { if (ModifierKeys == Keys.Control && !view.IsRowSelected(downHit.RowHandle)) this.BeginInvoke((Action) (() => view.SelectRow(downHit.RowHandle))); } } else if (e.Button == MouseButtons.Right) { if (!view.IsRowSelected(downHit.RowHandle)) SelectFocusedRow(view, downHit.RowHandle); } this.dontOpenEditor = true; }