当前位置: 首页>>代码示例>>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;未经允许,请勿转载。