private void targetPivot_MouseMove(object sender, MouseEventArgs e) { if (!onDrag) { if (e.Button == System.Windows.Forms.MouseButtons.Left) { PivotGridHitInfo hi = targetPivot.CalcHitInfo(e.Location); if (hi.HitTest == PivotGridHitTest.Value) { if ((AllowDragRow && hi.ValueInfo.Field.Area == PivotArea.RowArea) || (AllowDragColumn && hi.ValueInfo.Field.Area == PivotArea.ColumnArea)) { dragInfo = hi; onDrag = true; targetPivot.FindForm().Cursor = Cursors.Hand; } } } } else { DragDropEffects allowedEffect = GetDragEffect(e.Location); if (allowedEffect == DragDropEffects.None) { targetPivot.FindForm().Cursor = Cursors.No; } else { targetPivot.FindForm().Cursor = Cursors.Hand; } } }
private void pvgSICCleaned_MouseMove(object sender, MouseEventArgs e) { PivotGridControl Pivot = sender as PivotGridControl; PivotGridHitInfo hInfo = Pivot.CalcHitInfo(e.Location); if (hInfo == null || hInfo.CellInfo == null) { return; } if (hInfo.CellInfo.RowIndex <= Pivot.Cells.RowCount) { try { TheSelectedShiftNo = Pivot.Cells.GetCellInfo(hInfo.CellInfo.ColumnIndex, hInfo.CellInfo.RowIndex).GetFieldValue(colc_ShiftNo).ToString(); TheSelectedWorkplace = Pivot.Cells.GetCellInfo(hInfo.CellInfo.ColumnIndex, hInfo.CellInfo.RowIndex).GetFieldValue(colc_WP).ToString(); TheSelectedName = Pivot.Cells.GetCellInfo(hInfo.CellInfo.ColumnIndex, hInfo.CellInfo.RowIndex).GetFieldValue(colc_Name).ToString(); TheSelectedType = Pivot.Cells.GetCellInfo(hInfo.CellInfo.ColumnIndex, hInfo.CellInfo.RowIndex).GetFieldValue(colc_Type).ToString(); TheSelectedActivity = Pivot.Cells.GetCellInfo(hInfo.CellInfo.ColumnIndex, hInfo.CellInfo.RowIndex).GetFieldValue(colc_Activity).ToString(); TheSelectedDate = Pivot.Cells.GetCellInfo(hInfo.CellInfo.ColumnIndex, hInfo.CellInfo.RowIndex).GetFieldValue(colc_CalendarDate).ToString(); TheSelectedProblemCode = Pivot.Cells.GetCellInfo(hInfo.CellInfo.ColumnIndex, hInfo.CellInfo.RowIndex).GetFieldValue(colc_TheValue).ToString(); } catch (NullReferenceException ex) { } } }
/// <summary> /// Used to skip DashboardItemClick processing if the Expand/Collapse button is pressed /// </summary> void OnPivotGridControlMouseDown(object sender, MouseEventArgs e) { PivotGridControl pivot = sender as PivotGridControl; PivotGridHitInfo hi = pivot.CalcHitInfo(e.Location); skipFiltering = (hi.ValueInfo != null && hi.ValueInfo.ValueHitTest == PivotGridValueHitTest.ExpandButton); }
/// <summary> /// Used to get underlying data and display the DetailData dialog /// </summary> void DashboardItemClick(object sender, DashboardItemMouseActionEventArgs e) { if (IsDetailsEnabled(e.DashboardItemName)) { PivotGridControl pivot = dashboardDesigner.GetUnderlyingControl(e.DashboardItemName) as PivotGridControl; PivotGridHitInfo hi = pivot.CalcHitInfo(pivot.PointToClient(Cursor.Position)); bool doNotShowDataForThisArea = (hi.HitTest == PivotGridHitTest.Value && hi.ValueInfo.ValueHitTest == PivotGridValueHitTest.ExpandButton) || (hi.HitTest == PivotGridHitTest.None); if (!doNotShowDataForThisArea) { using (DetailData detailForm = new DetailData(e.GetUnderlyingData())) { detailForm.ShowDialog(); } } } }
private void pivotGridControl1_MouseMove(object sender, MouseEventArgs e) { PivotGridControl pivot = (PivotGridControl)sender; PivotGridHitInfo hitInfo = pivot.CalcHitInfo(e.Location); if (hitInfo.HitTest != PivotGridHitTest.HeadersArea) { return; } if (hitInfo.HeaderField != null && hitInfo.HeaderField.Area == PivotArea.DataArea && hitInfo.HeaderField.Options.AllowRunTimeSummaryChange) { PropertyInfo pInfo = typeof(PivotGridHeadersAreaHitInfo).GetProperty("HeadersViewInfo", BindingFlags.Instance | BindingFlags.NonPublic); PivotHeadersViewInfoBase headersViewInfo = pInfo.GetValue(hitInfo.HeadersAreaInfo, null) as PivotHeadersViewInfoBase; PivotHeaderViewInfo headerViewInfo = headersViewInfo[GetFieldItem(pivot, hitInfo.HeaderField)] as PivotHeaderViewInfo; MethodInfo mInfo = typeof(PivotHeaderViewInfo).GetMethod("ShowSummariesMenu", BindingFlags.NonPublic | BindingFlags.Instance); mInfo.Invoke(headerViewInfo, new object[] { }); } }
private void pvgSICCapture_MouseMove(object sender, MouseEventArgs e) { PivotGridControl Pivot = sender as PivotGridControl; PivotGridHitInfo hInfo = Pivot.CalcHitInfo(e.Location); if (hInfo == null || hInfo.CellInfo == null) { return; } if (hInfo.CellInfo.RowIndex <= Pivot.Cells.RowCount) { try { TheSelectedShiftNo = Pivot.Cells.GetCellInfo(hInfo.CellInfo.ColumnIndex, hInfo.CellInfo.RowIndex).GetFieldValue(col_ShiftNo).ToString(); TheSelectedSICKey = Pivot.Cells.GetCellInfo(hInfo.CellInfo.ColumnIndex, hInfo.CellInfo.RowIndex).GetFieldValue(col_SICKey).ToString(); } catch (NullReferenceException ex) { } } }
private void pvgSICCapture_MouseUp(object sender, MouseEventArgs e) { PivotGridControl Pivot = sender as PivotGridControl; PivotGridHitInfo hInfo = Pivot.CalcHitInfo(e.Location); if (hInfo == null || hInfo.CellInfo == null) { return; } if (hInfo.CellInfo.ColumnIndex >= 0) { if (e.Button == MouseButtons.Right) { if (Pivot.GetFieldValue(col_CalendarDate, hInfo.CellInfo.RowIndex).ToString() != "") { popupRow.ShowPopup(MousePosition); } } } }
private void PivotGridControl_MouseClick(object sender, MouseEventArgs e) { PivotGridControl pivot = sender as PivotGridControl; PivotGridHitInfo info = pivot.CalcHitInfo(e.Location); if (info.HitTest != PivotGridHitTest.Value) { return; } if (info.ValueInfo.Value == null) { return; } int fieldIdx = info.ValueInfo.Field.Index; int maxIdx = info.ValueInfo.MaxIndex; string fieldname = info.ValueInfo.Field.ToString(); string fieldvalue = info.ValueInfo.Value.ToString(); BindingList <ResultItem> chartResult = pivot.DataSource as BindingList <ResultItem>; string lineID = string.Empty; string designID = string.Empty; string prodID = string.Empty; string procID = string.Empty; string stepID = string.Empty; /* 차트 도입부 */ if (fieldname == "LINE_ID") { chartResult = chartResult.Where(x => x.LineID == fieldvalue).ToBindingList(); } else if (fieldname == "DESIGN_ID") { if (pivot.GetFieldValue(info.ValueInfo.Data.Fields[fieldIdx - 1], maxIdx) != null) { lineID = pivot.GetFieldValue(info.ValueInfo.Data.Fields[fieldIdx - 1], maxIdx).ToString(); } BindingList <ResultItem> list = new BindingList <ResultItem>(); foreach (var item in chartResult) { if (string.IsNullOrEmpty(lineID) == false && item.LineID != lineID) { continue; } if (item.DesignID != fieldvalue) { continue; } list.Add(item); } chartResult = list; } else if (fieldname == "PRODUCT_ID") { if (pivot.GetFieldValue(info.ValueInfo.Data.Fields[fieldIdx - 2], maxIdx) != null) { lineID = pivot.GetFieldValue(info.ValueInfo.Data.Fields[fieldIdx - 2], maxIdx).ToString(); } if (pivot.GetFieldValue(info.ValueInfo.Data.Fields[fieldIdx - 1], maxIdx) != null) { designID = pivot.GetFieldValue(info.ValueInfo.Data.Fields[fieldIdx - 1], maxIdx).ToString(); } BindingList <ResultItem> list = new BindingList <ResultItem>(); foreach (var item in chartResult) { if (string.IsNullOrEmpty(lineID) == false && item.LineID != lineID) { continue; } if (string.IsNullOrEmpty(designID) == false && item.DesignID != designID) { continue; } if (item.ProductID != fieldvalue) { continue; } list.Add(item); } chartResult = list; } else if (fieldname == "PROCESS_ID") { if (pivot.GetFieldValue(info.ValueInfo.Data.Fields[fieldIdx - 3], maxIdx) != null) { lineID = pivot.GetFieldValue(info.ValueInfo.Data.Fields[fieldIdx - 3], maxIdx).ToString(); } if (pivot.GetFieldValue(info.ValueInfo.Data.Fields[fieldIdx - 2], maxIdx) != null) { designID = pivot.GetFieldValue(info.ValueInfo.Data.Fields[fieldIdx - 2], maxIdx).ToString(); } if (pivot.GetFieldValue(info.ValueInfo.Data.Fields[fieldIdx - 1], maxIdx) != null) { prodID = pivot.GetFieldValue(info.ValueInfo.Data.Fields[fieldIdx - 1], maxIdx).ToString(); } BindingList <ResultItem> list = new BindingList <ResultItem>(); foreach (var item in chartResult) { if (string.IsNullOrEmpty(lineID) == false && item.LineID != lineID) { continue; } if (string.IsNullOrEmpty(designID) == false && item.DesignID != designID) { continue; } if (string.IsNullOrEmpty(prodID) == false && item.ProductID != prodID) { continue; } if (item.ProcessID != fieldvalue) { continue; } list.Add(item); } chartResult = list; } else if (fieldname == "STEP_ID") { if (pivot.GetFieldValue(info.ValueInfo.Data.Fields[fieldIdx - 4], maxIdx) != null) { lineID = pivot.GetFieldValue(info.ValueInfo.Data.Fields[fieldIdx - 4], maxIdx).ToString(); } if (pivot.GetFieldValue(info.ValueInfo.Data.Fields[fieldIdx - 3], maxIdx) != null) { designID = pivot.GetFieldValue(info.ValueInfo.Data.Fields[fieldIdx - 3], maxIdx).ToString(); } if (pivot.GetFieldValue(info.ValueInfo.Data.Fields[fieldIdx - 2], maxIdx) != null) { prodID = pivot.GetFieldValue(info.ValueInfo.Data.Fields[fieldIdx - 2], maxIdx).ToString(); } if (pivot.GetFieldValue(info.ValueInfo.Data.Fields[fieldIdx - 1], maxIdx) != null) { procID = pivot.GetFieldValue(info.ValueInfo.Data.Fields[fieldIdx - 1], maxIdx).ToString(); } BindingList <ResultItem> list = new BindingList <ResultItem>(); foreach (var item in chartResult) { if (string.IsNullOrEmpty(lineID) == false && item.LineID != lineID) { continue; } if (string.IsNullOrEmpty(designID) == false && item.DesignID != designID) { continue; } if (string.IsNullOrEmpty(prodID) == false && item.ProductID != prodID) { continue; } if (string.IsNullOrEmpty(procID) == false && item.ProcessID != procID) { continue; } if (item.StepID != fieldvalue) { continue; } list.Add(item); } chartResult = list; } else if (fieldname == "SEQUENCE") { if (pivot.GetFieldValue(info.ValueInfo.Data.Fields[fieldIdx - 5], maxIdx) != null) { lineID = pivot.GetFieldValue(info.ValueInfo.Data.Fields[fieldIdx - 5], maxIdx).ToString(); } if (pivot.GetFieldValue(info.ValueInfo.Data.Fields[fieldIdx - 4], maxIdx) != null) { designID = pivot.GetFieldValue(info.ValueInfo.Data.Fields[fieldIdx - 4], maxIdx).ToString(); } if (pivot.GetFieldValue(info.ValueInfo.Data.Fields[fieldIdx - 3], maxIdx) != null) { prodID = pivot.GetFieldValue(info.ValueInfo.Data.Fields[fieldIdx - 3], maxIdx).ToString(); } if (pivot.GetFieldValue(info.ValueInfo.Data.Fields[fieldIdx - 2], maxIdx) != null) { procID = pivot.GetFieldValue(info.ValueInfo.Data.Fields[fieldIdx - 2], maxIdx).ToString(); } if (pivot.GetFieldValue(info.ValueInfo.Data.Fields[fieldIdx - 1], maxIdx) != null) { stepID = pivot.GetFieldValue(info.ValueInfo.Data.Fields[fieldIdx - 1], maxIdx).ToString(); } BindingList <ResultItem> list = new BindingList <ResultItem>(); foreach (var item in chartResult) { if (string.IsNullOrEmpty(lineID) == false && item.LineID != lineID) { continue; } if (string.IsNullOrEmpty(designID) == false && item.DesignID != designID) { continue; } if (string.IsNullOrEmpty(prodID) == false && item.ProductID != prodID) { continue; } if (string.IsNullOrEmpty(procID) == false && item.ProcessID != procID) { continue; } if (string.IsNullOrEmpty(stepID) == false && item.StepID != stepID) { continue; } if (item.Sequence != Convert.ToDecimal(fieldvalue)) { continue; } list.Add(item); } chartResult = list; } DataTable chartTable = new DataTable(); chartTable.Columns.Add("PRODUCT_ID", typeof(string)); chartTable.Columns.Add("DATE", typeof(string)); chartTable.Columns.Add("MOVE", typeof(int)); chartTable.Columns.Add("TARGET", typeof(int)); chartTable.PrimaryKey = new DataColumn[] { chartTable.Columns["PRODUCT_ID"], chartTable.Columns["DATE"] }; List <string> SelProds = new List <string>(); foreach (var row in chartResult) { DataRow eRow = chartTable.Rows.Find(new object[] { row.ProductID, row.Date }); if (eRow != null) { eRow["MOVE"] = Convert.ToInt32(eRow["MOVE"]) + row.PlanQty; eRow["TARGET"] = Convert.ToInt32(eRow["TARGET"]) + row.TargetQty; } else { DataRow drow = chartTable.NewRow(); drow["PRODUCT_ID"] = row.ProductID; drow["DATE"] = row.Date; drow["MOVE"] = row.PlanQty; drow["TARGET"] = row.TargetQty; chartTable.Rows.Add(drow); } if (SelProds.Contains(row.ProductID) == false) { SelProds.Add(row.ProductID); } } DrawChart(chartTable, SelProds); }