当前位置: 首页>>代码示例>>C#>>正文


C# Grid.Redim方法代码示例

本文整理汇总了C#中Grid.Redim方法的典型用法代码示例。如果您正苦于以下问题:C# Grid.Redim方法的具体用法?C# Grid.Redim怎么用?C# Grid.Redim使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Grid的用法示例。


在下文中一共展示了Grid.Redim方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AttachedExistingSpannedCell_AddCellLater

		public void AttachedExistingSpannedCell_AddCellLater()
		{
			Grid grid1 = new Grid();
			grid1.Redim(1, 40);

			var cell = new SourceGrid.Cells.Cell();
			cell.ColumnSpan = 5;
			
			// this line should not throw exception, since everything is ok
			grid1[0, 0] = cell;
			
			// this line should throw exception, as there is a spanned cell
			// already
			var b = false;
			try
			{
				grid1[0, 1] = new SourceGrid.Cells.Cell();
			}
			catch (OverlappingCellException)
			{
				b = true;
			}
			
			Assert.AreEqual(b, true);
			
		}
开发者ID:wsrf2009,项目名称:KnxUiEditor,代码行数:26,代码来源:TestGrid_Span.cs

示例2: Bug5239

		public void Bug5239()
		{
			var grid1 = new Grid();
			grid1.Redim(4, 1);
			grid1.FixedRows = 1;

			for (int r = 0; r < grid1.RowsCount; r++)
			{
				if (r % 2 == 0)
				{
					grid1[r, 0] = new SourceGrid.Cells.Cell();
					grid1[r, 0].ColumnSpan = 2;
				}
			}
			
			// sort all cells
			var range = new Range(0, 0, grid1.Rows.Count - 1, grid1.Columns.Count - 1);
			grid1.SortRangeRows(range, 0, true, null);
			
			// loop via all cells
			for (var i = 0; i < grid1.Rows.Count; i++)
			{
				for (var col = 0; col < grid1.Columns.Count; col++)
				{
					// here we get exception : 
					// Grid should contain a spanned cell at position 0;0,  but apparently it does not!

					var cell = grid1[i, col];
				}
			
			}

		}
开发者ID:wsrf2009,项目名称:KnxUiEditor,代码行数:33,代码来源:TestGrid_Span.cs

示例3: ForceSpannedColumnsToMoveUp

		public void ForceSpannedColumnsToMoveUp()
		{
			// when we delete row, if the given row
			// is in the range of some cell spann,
			// then throw an exception
			Grid grid1 = new Grid();
			grid1.Redim(5, 5);
	
			// add single cell
			grid1[0, 1] = new SourceGrid.Cells.Cell();
			grid1[0, 1].ColumnSpan= 2;
			
			// add single cell
			grid1[0, 4] = new SourceGrid.Cells.Cell();
			grid1[0, 4].ColumnSpan = 2;
	
			// shorten the row span
			grid1.Columns.Remove(3);
			
			// spanned cell must be reduced
			Assert.AreEqual(2, grid1.SpannedCellReferences.SpannedRangesCollection.Count);
			var ranges = grid1.SpannedCellReferences.SpannedRangesCollection.ToArray();
			Assert.AreEqual(new Range(0, 1, 0, 2), ranges[1]);
			Assert.AreEqual(new Range(0, 3, 0, 4), ranges[0]);
			
		}
开发者ID:wsrf2009,项目名称:KnxUiEditor,代码行数:26,代码来源:TestGrid_Span_RemoveRows.cs

示例4: ShouldPaseIntoColumnsWith_VisibleFalse

		public void ShouldPaseIntoColumnsWith_VisibleFalse()
		{
			Grid grid1 = new Grid();
			grid1.Redim(6, 4);
			
			grid1[0, 0] = new SourceGrid.Cells.Cell("a");
			grid1[0, 1] = new SourceGrid.Cells.Cell("b");
			grid1[0, 2] = new SourceGrid.Cells.Cell("c");
			grid1[0, 3] = new SourceGrid.Cells.Cell("d");
			
			
			RangeData data = RangeData.LoadData(grid1, new Range(0, 0, 0, 3), CutMode.None);
			
			
			grid1.Columns[1].Visible = false;
			grid1[1, 0] = new SourceGrid.Cells.Cell("x", typeof(string));
			grid1[1, 1] = new SourceGrid.Cells.Cell("x", typeof(string));
			grid1[1, 2] = new SourceGrid.Cells.Cell("x", typeof(string));
			grid1[1, 3] = new SourceGrid.Cells.Cell("x", typeof(string));
			
			data.WriteData(grid1, new Position(1, 0));
			Assert.AreEqual("a", grid1[1, 0].Value);
			Assert.AreEqual("b", grid1[1, 1].Value);
			Assert.AreEqual("c", grid1[1, 2].Value);
			Assert.AreEqual("d", grid1[1, 3].Value);
		}
开发者ID:wsrf2009,项目名称:KnxUiEditor,代码行数:26,代码来源:TestClipboard.cs

示例5: CreateGrid

		private void CreateGrid()
		{
			grid = new Grid();
			grid.Redim(100, 10);
			grid.FixedRows = 0;
			rowsBase = grid.Rows;
			coord = new StandardHiddenRowCoordinator(grid.Rows);
		}
开发者ID:wsrf2009,项目名称:KnxUiEditor,代码行数:8,代码来源:TestStandardHiddenRowCoordinator.cs

示例6: RedimShouldRemove_SpannedCellReferences

		public void RedimShouldRemove_SpannedCellReferences()
		{
			Grid grid1 = new Grid();
			grid1.Redim(2, 5);
	
			// add single cell at row 1, with cell span 2
			grid1[1, 0] = new SourceGrid.Cells.Cell();
			grid1[1, 0].ColumnSpan = 2;
	
			// remove row at index 1
			grid1.Redim(1, 5);
			
			// increase grid
			grid1.Redim(2, 5);
	
			// add again cell at row 1
			grid1[1, 0] = new SourceGrid.Cells.Cell();
			grid1[1, 0].ColumnSpan = 2;
		}
开发者ID:wsrf2009,项目名称:KnxUiEditor,代码行数:19,代码来源:TestGrid_Span_RemoveRows.cs

示例7: ClearRows_ShouldClearLinkedControls

		public void ClearRows_ShouldClearLinkedControls()
		{
			Grid grid1 = new Grid();
			grid1.Redim(10, 1);
			grid1[0, 0] = new SourceGrid.Cells.Cell();
			RichTextBox rtb = new RichTextBox();
			SourceGrid.LinkedControlValue lk = new SourceGrid.LinkedControlValue(rtb, new SourceGrid.Position(0, 0));
			grid1.LinkedControls.Add(lk);
			grid1.Rows.Clear();
		}
开发者ID:wsrf2009,项目名称:KnxUiEditor,代码行数:10,代码来源:TestRowsBase.cs

示例8: SetUp

		public void SetUp()
		{
			m_grid = new Grid();
			m_grid.ClipboardMode = ClipboardMode.All;
			m_grid.Redim(2, 2);
			m_grid[0, 0] = new Cell(m_firstValue, typeof(int));
			m_grid[1, 1] = new Cell(m_secondValue, typeof(int));
			
			Assert.AreEqual(m_firstValue, m_grid[0, 0].Value);
			Assert.AreEqual(m_secondValue, m_grid[1, 1].Value);
		}
开发者ID:wsrf2009,项目名称:KnxUiEditor,代码行数:11,代码来源:TestGridVirtual_Clipboard.cs

示例9: ShouldNotCopyColumnsWith_VisibleFalse

		public void ShouldNotCopyColumnsWith_VisibleFalse()
		{
			Grid grid1 = new Grid();
			grid1.Redim(6, 2);
			
			grid1[0, 0] = new SourceGrid.Cells.Cell("a");
			grid1[0, 1] = new SourceGrid.Cells.Cell("b");
			grid1.Columns[1].Visible = false;
			
			RangeData data = RangeData.LoadData(grid1, new Range(0, 0, 0, 1), CutMode.None);
			Assert.AreEqual(1, data.SourceValues.Length);
			Assert.AreEqual("a", data.SourceValues[0, 0]);
		}
开发者ID:wsrf2009,项目名称:KnxUiEditor,代码行数:13,代码来源:TestClipboard.cs

示例10: Bug0003

		public void Bug0003()
		{
			var grid = new Grid();
			int rowCount = 10, colCount = 10;
			grid.Redim(rowCount, colCount);

			grid[0, 0] = new SourceGrid.Cells.Cell();
			grid[0, 0].ColumnSpan = 3;

			grid.Rows.Insert(0);
			grid[0, 0] = new SourceGrid.Cells.Cell();
			grid[0, 0].ColumnSpan = 3;
		}
开发者ID:wsrf2009,项目名称:KnxUiEditor,代码行数:13,代码来源:TestGrid_Span.cs

示例11: InsertCell_ForceSpannedColumnsToMoveRight

		public void InsertCell_ForceSpannedColumnsToMoveRight()
		{
			Grid grid1 = new Grid();
			grid1.Redim(5, 5);
	
			// add single cell at row 1, with cell span 2
			grid1[0, 1] = new SourceGrid.Cells.Cell();
			grid1[0, 1].ColumnSpan = 2;
			
			// increase grid
			grid1.Columns.Insert(0);
	
			Assert.AreEqual(1, grid1.SpannedCellReferences.SpannedRangesCollection.Count);
			Assert.AreEqual(new Range(0, 2, 0, 3), grid1.SpannedCellReferences.SpannedRangesCollection.ToArray()[0]);
		}
开发者ID:wsrf2009,项目名称:KnxUiEditor,代码行数:15,代码来源:TestGrid_Span_AddRows.cs

示例12: InsertCell_ForceSpannedRowsToExpand

		public void InsertCell_ForceSpannedRowsToExpand()
		{
			Grid grid1 = new Grid();
			grid1.Redim(5, 5);
	
			// add single cell at row 1, with cell span 2
			grid1[1, 0] = new SourceGrid.Cells.Cell();
			grid1[1, 0].RowSpan = 2;
			
			// increase grid
			grid1.Rows.Insert(2);
	
			Assert.AreEqual(1, grid1.SpannedCellReferences.SpannedRangesCollection.Count);
			Assert.AreEqual(new Range(1, 0, 3, 0), grid1.SpannedCellReferences.SpannedRangesCollection.ToArray()[0]);
		}
开发者ID:wsrf2009,项目名称:KnxUiEditor,代码行数:15,代码来源:TestGrid_Span_AddRows.cs

示例13: CreateRanges

		public RangeCreator CreateRanges()
		{
			var grid = new Grid();
			grid.Redim(RowCount, ColCount);
			SpannedRangesList = new SpannedRangesList();
			for (int r = 0; r < RowCount; r++)
				for (int c = 0; c < ColCount; c++)
			{
				if (c + Span < ColCount)
				{
					SpannedRangesList.Add(new Range(r, c, r, c + Span));
					c += Span;
				}
			}
			return this;
		}
开发者ID:wsrf2009,项目名称:KnxUiEditor,代码行数:16,代码来源:RangeCreator.cs

示例14: InsertRowAtSpannedCell_ShouldMoveSpannedRowDown

		public void InsertRowAtSpannedCell_ShouldMoveSpannedRowDown()
		{
			var grid1 = new Grid();
			grid1.Redim(4, 12);
			grid1.FixedRows = 2;
			
			var cell = new SourceGrid.Cells.Cell();
			grid1[3, 0] = cell;
			grid1[3, 0].ColumnSpan = 2;
			grid1.Rows.Insert(3);
			
			Assert.AreEqual(null, grid1[3, 0]);
			Assert.AreEqual(null, grid1[3, 1]);
			Assert.AreEqual(cell, grid1[4, 0]);
			Assert.AreEqual(cell, grid1[4, 1]);
		}
开发者ID:wsrf2009,项目名称:KnxUiEditor,代码行数:16,代码来源:TestGrid_Span_AddRows.cs

示例15: RemoveRowsShouldRmoveCellReferences

		public void RemoveRowsShouldRmoveCellReferences()
		{
			// when we delete row, sppanned cells on that row should be also deleted
			Grid grid1 = new Grid();
			grid1.Redim(5, 5);
	
			// add single cell at row 1, with cell span 2
			grid1[1, 0] = new SourceGrid.Cells.Cell();
			grid1[1, 0].ColumnSpan = 2;
	
			// remove row
			grid1.Rows.Remove(1);
			
			// add again cell at row 1
			grid1[1, 0] = new SourceGrid.Cells.Cell();
			// this will throw exception
			grid1[1, 0].ColumnSpan = 2;
		}
开发者ID:wsrf2009,项目名称:KnxUiEditor,代码行数:18,代码来源:TestGrid_Span_RemoveRows.cs


注:本文中的Grid.Redim方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。