コード例 #1
0
        private void gridDetailView_RowDoubleClick(object sender, RowDoubleClickEventArgs e)
        {
            // 화면 이동

            try
            {
                // 선택한 ROW
                TableView        tableView        = sender as TableView;
                TableViewHitInfo tableViewHitInfo = e.HitInfo as TableViewHitInfo;
                object           row = tableView.Grid.GetRow(tableViewHitInfo.RowHandle);

                if (row != null)
                {
                    // 부품
                    string strEqpId = ((EmsAlarmStatusDetail)row).EQP_ID;
                    string strEqpNm = ((EmsAlarmStatusDetail)row).EQP_NM;

                    using (E3002_01P frmEchkErrReg = new E3002_01P(strEqpId, strEqpNm))
                    {
                        frmEchkErrReg.ShowDialog();
                    }
                }
            }
            catch (Exception err)
            {
                this.BaseClass.Error(err);
            }
        }
コード例 #2
0
        private bool IsGridRowAvailable(MouseEventArgs e)
        {
            int rowHandle            = gridControl1.View.GetRowHandleByMouseEventArgs(e);
            TableViewHitInfo hitInfo = tableView1.CalcHitInfo(e.OriginalSource as DependencyObject);

            return(gridControl1.GetRow(rowHandle) != null && hitInfo.HitTest == TableViewHitTest.RowIndicator);
        }
コード例 #3
0
        private void gridControl_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            TableViewHitInfo hInfo = tableView.CalcHitInfo(e.GetPosition(tableView));

            if (hInfo.InRow)
            {
                int      rowNum   = hInfo.RowHandle;
                long     id       = (long)gridControl.GetCellValue(rowNum, "Id");
                TestInfo testInfo = null;
                using (DataModels.DatabaseDB db = new DataModels.DatabaseDB())
                {
                    var temp = from c in db.TestInfos where c.Id == id select c;
                    foreach (DataModels.TestInfo info in temp)
                    {
                        testInfo = new TestInfo
                        {
                            TestName = info.TestName,
                            Operator = info.Operator,
                            TestTime = info.Time,
                            Comment  = info.Comment
                        };
                    }
                }
                if (testInfo != null)
                {
                    HistoryDetailWindow detailWindow = new HistoryDetailWindow(testInfo);
                    detailWindow.Owner = this;
                    detailWindow.ShowDialog();
                }
            }
        }
        private void CheckHotTrack(System.Windows.Input.MouseEventArgs e)
        {
            TableViewHitInfo hi = CalcHitInfo(e.OriginalSource as DependencyObject);

            if (hi.RowHandle != GridControl.InvalidRowHandle)
            {
                FocusedRowHandle = hi.RowHandle;
            }
        }
        //TODO: improve this method
        void UpdateCurrentSelectionInfo()
        {
            CurrentSelectionInfo.MousePoint = Mouse.GetPosition(DataArea);
            Point pt = CurrentSelectionInfo.MousePoint;

            //Inside DataArea
            if (pt.X > 0 && pt.Y > 0 && pt.X < DataArea.ActualWidth && pt.Y < DataArea.ActualHeight)
            {
                HitTestResult result = VisualTreeHelper.HitTest(DataArea, CurrentSelectionInfo.MousePoint);
                if (result != null)
                {
                    DependencyObject hittedObject = result.VisualHit;
                    TableViewHitInfo hitInfo      = View.CalcHitInfo(hittedObject);
                    if (hitInfo.RowHandle != GridControl.InvalidRowHandle)
                    {
                        CurrentSelectionInfo.RowHandle = hitInfo.RowHandle;
                    }
                    if (hitInfo.Column != null)
                    {
                        CurrentSelectionInfo.Column = hitInfo.Column;
                    }
                }
                return;
            }
            //Outside DataArea
            CurrentSelectionInfo.RowHandle = GetRowhandle(CurrentSelectionInfo.MousePoint.Y);
            //Select to right
            GridColumn rightColumn, rightColumnWhenUnselect;

            GetRightVisibleColumn(out rightColumn, out rightColumnWhenUnselect);
            if (pt.X >= DataArea.ActualWidth && CurrentSelectionInfo.Column != null && StartSelectionInfo.Column.VisibleIndex <= CurrentSelectionInfo.Column.VisibleIndex)
            {
                if (rightColumn.VisibleIndex > CurrentSelectionInfo.Column.VisibleIndex)
                {
                    CurrentSelectionInfo.Column = rightColumn;
                }
                return;
            }
            //Unselecting to right
            if (pt.X >= DataArea.ActualWidth && StartSelectionInfo.Column.VisibleIndex >= CurrentSelectionInfo.Column.VisibleIndex)
            {
                if (rightColumnWhenUnselect.VisibleIndex >= CurrentSelectionInfo.Column.VisibleIndex)
                {
                    CurrentSelectionInfo.Column = rightColumnWhenUnselect;
                }
                return;
            }
            //Select to left
            if (pt.X <= 0)
            {
                GridColumn col = GetLeftVisibleColumn();
                CurrentSelectionInfo.Column = col;
                return;
            }
        }
        private bool GridControlCanStartDrag(GridControl source, MouseButtonEventArgs e, ref object dragData)
        {
            TableView        tableView = source.View as TableView;
            TableViewHitInfo hitInfo   = tableView.CalcHitInfo(e.OriginalSource as DependencyObject);

            if (tableView != null && hitInfo.InRow)
            {
                dragData = gridControl1.SelectedItems;
                return(dragData != null);
            }
            return(false);
        }
コード例 #7
0
        static void OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            TableView        view    = (sender as TableView);
            TableViewHitInfo hitInfo = view.CalcHitInfo(e.OriginalSource as DependencyObject);

            if (hitInfo.InRow && view.Grid.IsGroupRowHandle(hitInfo.RowHandle))
            {
                view.BeginSelection();
                SelectChild(view, hitInfo.RowHandle);
                view.EndSelection();
            }
        }
コード例 #8
0
        protected void PerformDropToView(DragDropManagerBase sourceManager, TableViewHitInfo hitInfo, Point pt, MoveRowsDelegate reorderDelegate, Func <bool, MoveRowsDelegate> groupDelegateExtractor, MoveRowsDelegate addRowsDelegate)
        {
            int insertRowHandle = hitInfo.RowHandle;
            var grid            = GetSourceGrid();

            if (this.GridControl.IsGroupRowHandle(insertRowHandle))
            {
                groupDelegateExtractor(true)(sourceManager, insertRowHandle, HitElement);
                return;
            }
            if (IsSortedButNotGrouped(grid) || hitInfo.HitTest == TableViewHitTest.DataArea)
            {
                if (sourceManager.DraggingRows.Count > 0 && GetDataAreaElement(HitElement) != null /* && !ReferenceEquals(sourceManager, this)*/)
                {
                    addRowsDelegate(sourceManager, insertRowHandle, HitElement);
                }
                else
                {
                    ClearDragInfo(sourceManager);
                }

                return;
            }
            if (insertRowHandle == GridControl.InvalidRowHandle || insertRowHandle == GridControl.AutoFilterRowHandle || insertRowHandle == GridControl.NewItemRowHandle)
            {
                ClearDragInfo(sourceManager);
                return;
            }
            if (this.GridControl.GroupCount > 0)
            {
                int groupRowHandle = this.GridControl.GetParentRowHandle(insertRowHandle);
                if (ShouldReorderGroup(grid))
                {
                    if (!IsSameGroup(sourceManager, GetGroupInfos(groupRowHandle), HitElement))
                    {
                        groupDelegateExtractor(false)(sourceManager, groupRowHandle, HitElement);
                    }
                    reorderDelegate(sourceManager, insertRowHandle, HitElement);
                }
                else
                {
                    groupDelegateExtractor(true)(sourceManager, groupRowHandle, HitElement);
                }
            }
            else
            {
                reorderDelegate(sourceManager, insertRowHandle, HitElement);
            }
        }
 void OnGridPreviewMouseDown(object sender, MouseButtonEventArgs e)
 {
     if (!IsLogicBlocked)
     {
         StartSelectionInfo.Clear();
         TableViewHitInfo hitInfo = View.CalcHitInfo(e.OriginalSource as DependencyObject);
         if (!hitInfo.InRow && !hitInfo.InRowCell)
         {
             return;
         }
         StartSelectionInfo.MousePoint = e.GetPosition(DataArea);
         StartSelectionInfo.RowHandle  = hitInfo.RowHandle;
         StartSelectionInfo.Column     = hitInfo.Column;
     }
 }
コード例 #10
0
        /// <summary>
        /// 그리드 Row 더블클릭 이벤트
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tvFirstGrid_RowDoubleClick(object sender, RowDoubleClickEventArgs e)
        {
            TableView        tableView        = sender as TableView;
            TableViewHitInfo tableViewHitInfo = e.HitInfo as TableViewHitInfo;
            object           row = tableView.Grid.GetRow(tableViewHitInfo.RowHandle);

            // 고객사 코드
            string strCstCD = ((DataMembers.PopupCst)row).CST_CD;
            // 고객사 명
            string strCstName = ((DataMembers.PopupCst)row).CST_NM;

            if (strCstCD.Length > 0)
            {
                this.SearchResult(strCstCD, strCstName);
                this.Close();
            }
        }
コード例 #11
0
        private void TvFirstGrid_RowDoubleClick(object sender, DevExpress.Xpf.Grid.RowDoubleClickEventArgs e)
        {
            TableView        tableView        = sender as TableView;
            TableViewHitInfo tableViewHitInfo = e.HitInfo as TableViewHitInfo;
            object           row = tableView.Grid.GetRow(tableViewHitInfo.RowHandle);

            var strShipCD  = ((DataMembers.PopupSku)row).SKU_CD;        // SKU 코드
            var strShipNM  = ((DataMembers.PopupSku)row).SKU_NM;        // SKU명
            var strCstCD   = ((DataMembers.PopupSku)row).CST_CD;        // 고객사 코드
            var strCstName = ((DataMembers.PopupSku)row).CST_NM;        // 고객사 명


            if (strShipCD.Length > 0)
            {
                this.SearchResult(strShipCD, strShipNM, strCstCD, strCstName);
                this.Close();
            }
        }
コード例 #12
0
        private void gridMainView_RowDoubleClick(object sender, RowDoubleClickEventArgs e)
        {
            try
            {
                if (this.gridDetail.ItemsSource != null)
                {
                    this.gridDetail.ItemsSource = null;
                }

                // 선택한 ROW
                TableView        tableView        = sender as TableView;
                TableViewHitInfo tableViewHitInfo = e.HitInfo as TableViewHitInfo;
                object           row = tableView.Grid.GetRow(tableViewHitInfo.RowHandle);

                if (row != null)
                {
                    // 부품 ID
                    string strPartID = ((EmsAlarmStatus)row).PART_ID;

                    // 디테일 데이타 QUERY
                    var results = from myRow in dtAlarmSTatusDetail.AsEnumerable()
                                  where myRow.Field <string>("PART_ID") == strPartID
                                  select myRow;

                    DataTable dtTmp = results.CopyToDataTable();

                    //디테일 그리드 바인딩
                    EmsAlarmStatusDetailList = new ObservableCollection <EmsAlarmStatusDetail>();
                    EmsAlarmStatusDetailList.ToObservableCollection(dtTmp);
                    this.gridDetail.ItemsSource = EmsAlarmStatusDetailList;

                    this.btnExcelHigh.IsEnabled = true;
                }
            }
            catch (Exception err)
            {
                this.BaseClass.Error(err);
            }
        }
コード例 #13
0
        void tableView1_PreviewDrop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(typeof(SchedulerDragData)))
            {
                SchedulerDragData schedulerData = ((SchedulerDragData)e.Data.GetData(typeof(SchedulerDragData)));
                DataRow           dataRow       = ObtainDataRowFromSchedulerData(schedulerData);
                DataTable         dataTable     = (DataTable)gridControl1.ItemsSource;
                TableViewHitInfo  hitInfo       = tableView1.CalcHitInfo(e.OriginalSource as DependencyObject);
                int rowIndex = dataTable.Rows.Count;

                if (hitInfo.RowHandle != GridControl.InvalidRowHandle)
                {
                    rowIndex = gridControl1.GetListIndexByRowHandle(hitInfo.RowHandle);
                }

                if (this.dragFromGrid)
                {
                    tableView1.DeleteRow(currentRowHandle);
                }

                dataTable.Rows.InsertAt(dataRow, rowIndex);
                schedulerData.PrimaryAppointment.Delete();
            }
        }
コード例 #14
0
ファイル: EventArgs.cs プロジェクト: phanvanthanh/QLThueBao
		public GridDragOverEventArgs(TableViewHitInfo hitInfo, IList dragRows)
			: base(dragRows) {
			HitInfo = hitInfo;
		}
コード例 #15
0
		GridDropEventArgs RaiseDropEvent(DragDropManagerBase sourceManager, TableViewHitInfo hitInfo, IList rows, DropTargetType dropTargetType) {
			GridDropEventArgs e = new GridDropEventArgs() {
				HitInfo = hitInfo,
				DraggedRows = rows,
				DropTargetType = dropTargetType,
				Handled = false,
				Manager = this,
				SourceManager = sourceManager,
				GridControl = GridControl,
			};
			if(DropEventHandler != null)
				DropEventHandler(this, e);
			return e;
		}
コード例 #16
0
		GridDragOverEventArgs RaiseDragOverEvent(TableViewHitInfo hitInfo, DragDropManagerBase sourceManager) {
			GridDragOverEventArgs e = new GridDragOverEventArgs(hitInfo, sourceManager.DraggingRows) {
				Handled = false,
				Manager = this,
				SourceManager = sourceManager,
			};
			if(DragOverEventHandler != null)
				DragOverEventHandler(this, e);
			return e;
		}
コード例 #17
0
		bool BanDrop(int insertRowHandle, TableViewHitInfo hitInfo, DragDropManagerBase sourceManager) {
			GridDragOverEventArgs e = RaiseDragOverEvent(hitInfo, sourceManager);
			return e.Handled ? !e.AllowDrop : !e.AllowDrop || InternalBanDrop(insertRowHandle, sourceManager);
		}
コード例 #18
0
		bool IsInRowCore(TableViewHitInfo info) {
			return info.InRow && info.HitTest != TableViewHitTest.RowIndicator;
		}
コード例 #19
0
		internal bool IsInGroupRow(TableViewHitInfo info) {
			return IsInRowCore(info) && GridControl.IsGroupRowHandle(info.RowHandle);
		}