private void OnGridCellMouseDown(object sender, MouseEventArgs e)
		{
			var ht = _folderBox.grFiles.HitTest(e.X, e.Y);
			if (ht.Type == DataGridViewHitTestType.Cell)
			{
				_hitTest = ht;
				_dragBox = new Rectangle(
					new Point(e.X - (SystemInformation.DragSize.Width / 2),
						e.Y - (SystemInformation.DragSize.Height / 2)),
					SystemInformation.DragSize);
			}
			else
				_hitTest = null;
		}
		private void OnGridCellMouseMove(object sender, MouseEventArgs e)
		{
			if (_hitTest == null || _dragBox.Contains(e.X, e.Y)) return;
			var linkRow = (LinkRow)_folderBox.grFiles.Rows[_hitTest.RowIndex];
			var fileLink = linkRow.Source as LibraryFileLink;
			if (fileLink == null || fileLink.IsFolder)
				return;
			var data = new DataObject();
			data.SetData(DataFormats.FileDrop, new[] { fileLink.FullPath });
			data.SetData(DataFormats.StringFormat, fileLink.FullPath);
			data.SetData(DataFormats.Serializable, fileLink);
			_folderBox.DoDragDrop(data, DragDropEffects.Copy);
			_hitTest = null;
		}
Exemplo n.º 3
0
        private void gridContext_Opening(object sender, CancelEventArgs e)
        {
            Point tLocation = new Point(Cursor.Position.X, Cursor.Position.Y);
            tLocation = dgv1.PointToClient(Cursor.Position);
            tHitTestInfo = dgv1.HitTest(tLocation.X, tLocation.Y);
            if (tHitTestInfo.Type == DataGridViewHitTestType.Cell)
            {
                foreach (DataGridViewCell cell in dgv1.SelectedCells)
                {
                    cell.Selected = false;
                }

                dgv1[tHitTestInfo.ColumnIndex, tHitTestInfo.RowIndex].Selected = true;
            }
        }
Exemplo n.º 4
0
 private void OnGridViewClicked(object sender, MouseEventArgs e)
 {
     hitTestGrid = dataGridView1.HitTest(e.X, e.Y);
     int selectedRow;
     if ((hitTestGrid.RowY  == -1) || (hitTestGrid.ColumnX  == -1))
     {
         return;
     }
     if (hitTestGrid.ColumnIndex   == 0)
     {
         selectedRow = hitTestGrid.RowIndex;
         BuildNewDataTable(selectedRow);
     }
 }
Exemplo n.º 5
0
 void dataGridView1_MouseUp(object sender, MouseEventArgs e)
 {
     // Load context menu on right mouse click
     if (e.Button == MouseButtons.Right)
         hitTestInfo = dataGridView1.HitTest(e.X, e.Y);
 }
Exemplo n.º 6
0
        private void dgv1_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (!isActual)
            {
                ulog.Message("Необходимо повторно выбрать мероприятия!", UserLogMessageLevel.Error);
                return;
            }

            Point tLocation = new Point(Cursor.Position.X, Cursor.Position.Y);
            tLocation = dgv1.PointToClient(Cursor.Position);
            tHitTestInfo = dgv1.HitTest(tLocation.X, tLocation.Y);

            BindingSource bs1 = (eCategory == eventCategory.CurrentEvent) ? eventsBindingSource : calendar_eventsBindingSource;
            BindingSource bs2 = (eCategory == eventCategory.CurrentEvent) ? actionsBindingSource : calendar_actionsBindingSource;

            if (tHitTestInfo.Type == DataGridViewHitTestType.Cell)
            {
                dgv1[tHitTestInfo.ColumnIndex, tHitTestInfo.RowIndex].Selected = true;
                EventProcessing(tHitTestInfo.ColumnIndex, tHitTestInfo.RowIndex, bs1, bs2);
            }
        }
		private void OnGridCellMouseMove(object sender, DataGridViewCellMouseEventArgs e)
		{
			if (!FormatState.AllowEdit) return;
			if (DataSource.Links.Any())
				Cursor = Cursors.Hand;
			if (((e.Button & MouseButtons.Left) != MouseButtons.Left) ||
				Equals(_mouseDownHitInfo, DataGridView.HitTestInfo.Nowhere) ||
				_dragStartBox.Contains(e.X, e.Y))
				return;
			var selectedLink = SelectedLinkRow;
			if (selectedLink != null)
				grFiles.DoDragDrop(selectedLink, DragDropEffects.All);
			_mouseDownHitInfo = DataGridView.HitTestInfo.Nowhere;
		}
		private void OnGridCellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
		{
			if (!FormatState.AllowEdit) return;
			_mouseDownHitInfo = DataGridView.HitTestInfo.Nowhere;
		}
		private void OnGridCellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
		{
			if (!FormatState.AllowEdit) return;
			_dragStartBox = new Rectangle(
				new Point(
					e.X - (SystemInformation.DragSize.Width / 2),
					e.Y - (SystemInformation.DragSize.Height / 2)),
				SystemInformation.DragSize);
			_mouseDownHitInfo = grFiles.HitTest(e.X, e.Y);
		}
Exemplo n.º 10
0
		private void OnDragOver(object sender, DragEventArgs e)
		{
			FolderContainer.ProcessScrollOnDragOver(sender, e);
			if (!FormatState.AllowEdit) return;
			DataDraggedOver = e.Data;
			if (!IsDataDragged) return;
			if (IsSourceLinksDragged)
				e.Effect = DragDropEffects.Copy;
			else if (IsLinkRowDragged)
				e.Effect = DragDropEffects.Move;
			else if (IsFolderBoxDragged)
				e.Effect = DragDropEffects.Move;
			else if (IsLinkBundleDragged)
				e.Effect = DragDropEffects.Copy;
			else
			{
				e.Effect = DragDropEffects.None;
				ResetDragInfo();
				return;
			}

			var pt = grFiles.PointToClient(new Point(e.X, e.Y));
			var dragOverInfo = grFiles.HitTest(pt.X, pt.Y);
			if (!dragOverInfo.Equals(_mouseDragOverHitInfo))
			{
				_mouseDragOverHitInfo = dragOverInfo;
				grFiles.Refresh();
			}
		}
Exemplo n.º 11
0
		private void ResetDragInfo()
		{
			bool needGridRefersh = IsSourceLinksDragged || IsLinkRowDragged || IsLinkBundleDragged;
			DataDraggedOver = null;
			_mouseDragOverHitInfo = DataGridView.HitTestInfo.Nowhere;
			if (needGridRefersh)
				grFiles.Refresh();
		}