當前位置: 首頁>>代碼示例>>C#>>正文


C# SourceGrid.Position類代碼示例

本文整理匯總了C#中SourceGrid.Position的典型用法代碼示例。如果您正苦於以下問題:C# Position類的具體用法?C# Position怎麽用?C# Position使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Position類屬於SourceGrid命名空間,在下文中一共展示了Position類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: From

		public static Range From(Position startPosition, int rowCount, int colCount)
		{
			var range = new Range(startPosition);
			range.RowsCount = rowCount;
			range.ColumnsCount = colCount;
			return range;
		}
開發者ID:wsrf2009,項目名稱:KnxUiEditor,代碼行數:7,代碼來源:Range.cs

示例2: Range

		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="p_StartRow"></param>
		/// <param name="p_StartCol"></param>
		/// <param name="p_EndRow"></param>
		/// <param name="p_EndCol"></param>
		public Range(int p_StartRow, int p_StartCol, int p_EndRow, int p_EndCol)
		{
			m_Start = new Position(p_StartRow, p_StartCol);
			m_End = new Position(p_EndRow, p_EndCol);

			Normalize();
		}
開發者ID:wsrf2009,項目名稱:KnxUiEditor,代碼行數:14,代碼來源:Range.cs

示例3: GetFirstIntersectedRange

		public Range? GetFirstIntersectedRange(Position pos)
		{
			var result = base.QueryFirst(pos);
			if (result == null)
				return null;
			return result;
		}
開發者ID:wsrf2009,項目名稱:KnxUiEditor,代碼行數:7,代碼來源:QuadTreeRangesList.cs

示例4: MoveTo

		/// <summary>
		/// Move the current range to the specified position, leaving the current ColumnsCount and RowsCount
		/// </summary>
		/// <param name="p_StartPosition"></param>
		public void MoveTo(Position p_StartPosition)
		{
			int l_ColCount = ColumnsCount;
			int l_RowCount = RowsCount;
			m_Start = p_StartPosition;
			RowsCount = l_RowCount;
			ColumnsCount = l_ColCount;
		}
開發者ID:wsrf2009,項目名稱:KnxUiEditor,代碼行數:12,代碼來源:Range.cs

示例5: PositionToCellRange

		/// <summary>
		/// This method converts a Position to the real range of the cell. This is usefull when RowSpan or ColumnSpan is greater than 1.
		/// For example suppose to have at grid[0,0] a cell with ColumnSpan equal to 2. If you call this method with the position 0,0 returns 0,0-0,1 and if you call this method with 0,1 return again 0,0-0,1.
		/// </summary>
		/// <param name="pPosition"></param>
		/// <returns></returns>
		public override Range PositionToCellRange(Position pPosition)
		{
			if (pPosition.IsEmpty())
				return Range.Empty;

			Cells.ICell l_Cell = this[pPosition.Row, pPosition.Column];
			if (l_Cell == null)
				return Range.Empty;
			else
				return l_Cell.Range;
		}
開發者ID:wsrf2009,項目名稱:KnxUiEditor,代碼行數:17,代碼來源:Grid.cs

示例6: EnsureNoSpannedCellsExist

		private void EnsureNoSpannedCellsExist(int row, int col, Cells.ICell p_cell)
		{
			var spanRange = new Range(row, col, row + p_cell.RowSpan - 1, col + p_cell.ColumnSpan - 1);
			var ranges = spannedCellReferences.SpannedRangesCollection.GetRanges(
				spanRange);
			if (ranges.Count == 0)
				return;
			
			var start = new Position(row, col);
			foreach (var range in ranges)
			{
				if (start.Equals(range.Start) == true)
					continue;
				Cells.ICell existingSpannedCell = this[range.Start];
				if (existingSpannedCell == null)
					throw new ArgumentException("internal error. please report this bug to developers");
				throw new OverlappingCellException(string.Format(
					"Given cell at position ({0}, {1}), " +
					"intersects with another cell " +
					"at position ({2}, {3}) '{4}'",
					row, col,
					existingSpannedCell.Row.Index,
					existingSpannedCell.Column.Index,
					existingSpannedCell.DisplayText));
			}
			
		}
開發者ID:wsrf2009,項目名稱:KnxUiEditor,代碼行數:27,代碼來源:Grid.cs

示例7: GetSpannedCell

		/// <summary>
		/// Check if a cell exists in spanned cells.
		/// If yes, returns. If no, returns null
		/// </summary>
		private Cells.ICell GetSpannedCell(Position pos)
		{
			var range = spannedCellReferences.SpannedRangesCollection.GetFirstIntersectedRange(pos);
			if (range == null)
				return null;
			Position cellPos = range.Value.Start;
			Cells.ICell cell = DirectGetCell(cellPos);
			if (cell == null)
				throw new ArgumentException(string.Format(
					"Invalid grid state. Grid should contain a spanned cell at position {0}, " +
					" but apparently it does not!", cellPos));
			return cell;
		}
開發者ID:wsrf2009,項目名稱:KnxUiEditor,代碼行數:17,代碼來源:Grid.cs

示例8: DirectGetCell

		private Cells.ICell DirectGetCell(Position position)
		{
			if (IsInGrid(position) == false)
				return null;
			if (OptimizeMode == CellOptimizeMode.ForRows)
			{
				GridRow row = Rows[position.Row];
				if (row == null)
					return null;

				return row[Columns[position.Column] as GridColumn];
			}
			else if (OptimizeMode == CellOptimizeMode.ForColumns)
			{
				GridColumn col = Columns[position.Column] as GridColumn;
				if (col == null)
					return null;
				
				return col[Rows[position.Row]];
			}
			else
				throw new SourceGridException("Invalid OptimizeMode");
		}
開發者ID:wsrf2009,項目名稱:KnxUiEditor,代碼行數:23,代碼來源:Grid.cs

示例9: DirectSetCell

		private void DirectSetCell(Position position, Cells.ICell cell)
		{
			if (OptimizeMode == CellOptimizeMode.ForRows)
			{
				GridRow row = Rows[position.Row];
				if (position.Column >= Columns.Count)
					throw new ArgumentException(string.Format(
						"Grid has only {0} columns, you tried to insert cell into position {1}." +
						"You should probably call Redim on grid to increase it's column size",
						Columns.Count, position.ToString()));

				row[Columns[position.Column] as GridColumn] = cell;
			}
			else if (OptimizeMode == CellOptimizeMode.ForColumns)
			{
				GridColumn col = Columns[position.Column] as GridColumn;

				col[Rows[position.Row]] = cell;
			}
			else
				throw new SourceGridException("Invalid OptimizeMode");
		}
開發者ID:wsrf2009,項目名稱:KnxUiEditor,代碼行數:22,代碼來源:Grid.cs

示例10: CellContext

		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="pGridVirtual"></param>
		/// <param name="pPosition"></param>
		public CellContext(GridVirtual pGridVirtual, Position pPosition)
		{
			Position = pPosition;
			Grid = pGridVirtual;
			Cell = Grid.GetCell(Position);
		}
開發者ID:Xavinightshade,項目名稱:ipsimulator,代碼行數:11,代碼來源:CellContext.cs

示例11: FindFirstFocusableRowInUpDirection

		int FindFirstFocusableRowInUpDirection(int BottomRow)
		{
			for (int k = BottomRow; k > ActualFixedRows; k--)
			{
				Position newPosition = new Position(k, Selection.ActivePosition.Column);
				if (Selection.CanReceiveFocus(newPosition)) return k;
			}
			return -1;
		}
開發者ID:js1987,項目名稱:openpetragit,代碼行數:9,代碼來源:GridVirtual.cs

示例12: CustomScrollPageUp

		public override void CustomScrollPageUp()
		{
			bool NeedActualScrolling=false;
			int NewProposedTopRow=0;
			int NewProposedFocusedRow=0;

			//confusing NAMING: ActivePosition -> FocusedPosition - it would be better
			int FocusedRow = Selection.ActivePosition.Row;
			//TODO: if there is no selection here (ActiveRow is undefined),
			//put selection in the first possible cell
			//confusing NAMING: Rows.IsRowVisible -> Rows.NotHidden - because it is not hidden,
			//                  may be confused with visible on screen within visible page

			
			if (FocusedRow == -1)
			{
				Selection.MoveActiveCell(-1, 0);
				return;
			}


			List<int> rows = GetVisibleRows(false);

			//TODO: if Rows.height<displayheight
			if (rows.Count <= ActualFixedRows + 1)
			{
				Selection.MoveActiveCell(-1, 0);
				return;
			};
			
			int firstVisibleRow = rows[ActualFixedRows];
			int lastVisibleRow = rows[rows.Count - 1];

			//another workaround: if (focusedrow==firstVisibleRow)
			//if the row above has height larger than displayheight it is also like one row scrolling-
			//so workaround is needed like the one above
			if (FocusedRow == firstVisibleRow)
				if (FocusedRow>ActualFixedRows)
			{
				int displayHeight = DisplayRectangle.Height;

				//Remove the fixed rows from the scrollable area
				for (int f = 0; f < ActualFixedRows; f++)
					displayHeight -= Rows.GetHeight(f);

				if (displayHeight <= Rows.GetHeight(FocusedRow - 1))
				{
					Selection.MoveActiveCell(-1, 0);
					return;
				}
			}

            // AlanP: Sep 2013  We need to know if SHIFT is pressed
            bool shiftPressed = Control.ModifierKeys == Keys.Shift;

            if (IsThisRowVisibleOnScreen(FocusedRow))
			{   //focus is on the screen

				int TopmostFocusableRow = GetTopmostFocusableRowFromRange(firstVisibleRow, lastVisibleRow);
				if (TopmostFocusableRow == FocusedRow)
				{   //need actual scrolling, ie. displaying new page
					int FindFirstFocusableRow = FindFirstFocusableRowInUpDirection(firstVisibleRow);
					if (FindFirstFocusableRow != -1)
					{
						NeedActualScrolling = true;
						int NewProposedBottomRow = firstVisibleRow;
						NewProposedTopRow = GetTopVisibleRowFromBottomRow(NewProposedBottomRow);
						NewProposedFocusedRow = GetTopmostFocusableRowFromRange(NewProposedTopRow, NewProposedBottomRow);

						if (NewProposedFocusedRow == -1)
						{//There is no Focusable Row in the proposed page, so there need to be new page and focus found
							NewProposedFocusedRow = FindFirstFocusableRowInUpDirection(NewProposedTopRow);
							NewProposedTopRow = NewProposedFocusedRow;
						}
					}
					else
					{   //no focusable cells below -
						//in this case we might scroll down page, leaving focus unchanged
						//or move focus to the side like in arrow down handler
						
						//this is only temporary
						//MICK(24)
						Selection.MoveActiveCell(-1, 0);
						return;
					}
				}
				else
				{   //this time only move focus, wihout actual scrolling

					Position newPosition = new Position(TopmostFocusableRow, Selection.ActivePosition.Column);
                    // AlanP: Sep 2013  We inhibit change events if SHIFT is pressed because we still have more calls to do
                    Selection.Focus(newPosition, true, shiftPressed);
				}

			}
			else
			{// focus is not on the screen, so actual scrolling is done always
				NeedActualScrolling = true;

				int NewProposedBottomRow = FocusedRow;
//.........這裏部分代碼省略.........
開發者ID:js1987,項目名稱:openpetragit,代碼行數:101,代碼來源:GridVirtual.cs

示例13: FindFirstFocusableRowInDownDirection

		int FindFirstFocusableRowInDownDirection(int TopRow)
		{
			for (int k = TopRow; k < Rows.Count; k++)
			{
				Position newPosition = new Position(k, Selection.ActivePosition.Column);
				if (Selection.CanReceiveFocus(newPosition)) return k;
			}
			return -1;
		}
開發者ID:js1987,項目名稱:openpetragit,代碼行數:9,代碼來源:GridVirtual.cs

示例14: CustomScrollPageDown

		public override void CustomScrollPageDown()
		{
			bool NeedActualScrolling=false;
			int NewProposedTopRow=0;
			int NewProposedFocusedRow=0;

			Range rngFocusedCell = PositionToCellRange(Selection.ActivePosition);
			
			//if there is no selection here (ActiveRow is undefined),
			//put selection in the first possible cell
			//confusing NAMING: Rows.IsRowVisible -> Rows.NotHidden - because it is not hidden,
			//                  may be confused with visible on screen within visible page

			if (rngFocusedCell.IsEmpty())
			{
				Selection.MoveActiveCell(1, 0);
				return;
			}

			List<int> rows = GetVisibleRows(false);

			if (rows.Count <= ActualFixedRows + 1)
			{
				Selection.MoveActiveCell(1, 0);
				return;
			};
			
			int firstVisibleRow = rows[ActualFixedRows];
			int lastVisibleRow = rows[rows.Count - 1];

            // AlanP: Sep 2013  We need to know if SHIFT is pressed
            bool shiftPressed = Control.ModifierKeys == Keys.Shift;

			if (IsThisRowVisibleOnScreen(rngFocusedCell.Start.Row))
			{   //focus is on the screen

				int BottommostFocusableRow = GetBottommostFocusableRowFromRange(firstVisibleRow, lastVisibleRow);
				if (rngFocusedCell.ContainsRow(BottommostFocusableRow))
				{   //need actual scrolling, ie. displaying new page
					int FindFirstFocusableRow = FindFirstFocusableRowInDownDirection(lastVisibleRow);
					if (FindFirstFocusableRow != -1)
					{
						NeedActualScrolling = true;
						NewProposedTopRow = lastVisibleRow;
						int NewProposedBottomRow = GetBottomVisibleRowFromTopRow(NewProposedTopRow);
						NewProposedFocusedRow = GetBottommostFocusableRowFromRange(NewProposedTopRow, NewProposedBottomRow);

						if (NewProposedFocusedRow == -1)
						{//There is no Focusable Row in the proposed page, so there need to be new page and focus found
							NewProposedFocusedRow = FindFirstFocusableRowInDownDirection(NewProposedBottomRow);
							NewProposedTopRow = GetTopVisibleRowFromBottomRow(NewProposedFocusedRow);
						}
					}
					else
					{   //no focusable cells below -
						//in this case we might scroll down page, leaving focus unchanged
						//or move focus to the side like in arrow down handler
						
						//this is only temporary
						//MICK(23)
						Selection.MoveActiveCell(1, 0);
						return;
					}
				}
				else
				{   //this time only move focus, wihout actual scrolling

					Position newPosition = new Position(BottommostFocusableRow, Selection.ActivePosition.Column);
                    // AlanP: Sep 2013  We inhibit change events if SHIFT is pressed because we still have more calls to do
					Selection.Focus(newPosition, true, shiftPressed);
				}

			}
			else
			{// focus is not on the screen, so actual scrolling is done always
				NeedActualScrolling = true;
				NewProposedTopRow = rngFocusedCell.Start.Row;
				int NewProposedBottomRow = GetBottomVisibleRowFromTopRow(NewProposedTopRow);
				NewProposedFocusedRow = GetBottommostFocusableRowFromRange(NewProposedTopRow, NewProposedBottomRow);
			}

			if (NeedActualScrolling)
			{
				int NewTopRow=0;
				int NewFocusedRow=0;

				GetValidScrollDown(NewProposedTopRow, NewProposedFocusedRow, out NewTopRow, out NewFocusedRow);
				NewTopRow = ExtendTopRowByHiddenRows(NewTopRow);

				base.CustomScrollPageToLine(NewTopRow - ActualFixedRows);

				if (rngFocusedCell.ContainsRow(NewFocusedRow) == false)
				{
					Position newPosition = new Position(NewFocusedRow, Selection.ActivePosition.Column);
                    // AlanP: Sep 2013  We inhibit change events if SHIFT is pressed because we still have more calls to do
                    Selection.Focus(newPosition, true, shiftPressed);
				}

			}

//.........這裏部分代碼省略.........
開發者ID:js1987,項目名稱:openpetragit,代碼行數:101,代碼來源:GridVirtual.cs

示例15: ChangeDragCell

		/// <summary>
		/// Fired when the cell in the drag events change. For internal use only.
		/// </summary>
		/// <param name="cell"></param>
		/// <param name="pDragEventArgs"></param>
		public virtual void ChangeDragCell(CellContext cell, DragEventArgs pDragEventArgs)
		{
			if (cell.Position != mDragCellPosition)
			{
				if (mDragCellPosition.IsEmpty() == false)
					Controller.OnDragLeave(new CellContext(this, mDragCellPosition, GetCell(mDragCellPosition)), pDragEventArgs);
				
				if (cell.Position.IsEmpty() == false)
					Controller.OnDragEnter(cell, pDragEventArgs);

				mDragCellPosition = cell.Position;
			}
		}
開發者ID:js1987,項目名稱:openpetragit,代碼行數:18,代碼來源:GridVirtual.cs


注:本文中的SourceGrid.Position類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。