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


C# RangeCollection.ContainsCell方法代码示例

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


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

示例1: OnPrintPage

		protected override void OnPrintPage(PrintPageEventArgs e)
		{
			base.OnPrintPage(e);
			if (m_PageCount == 0)
			{
				m_HeaderHeight = this.GetHeaderHeight(e.Graphics);
				m_TitleHeight = this.GetTitleHeight(e.Graphics);
				m_FooterHeight = this.GetFooterHeight(e.Graphics);
				m_PageCount = this.PrecalculatePageCount(e);
				m_PageNo = 1;
			}

			if (m_RangeToPrint.IsEmpty())
				return;

			if ( m_BorderPen == null )
				m_BorderPen = new Pen(Color.Black);

			RectangleF area = new RectangleF(e.MarginBounds.Left,
			                                 e.MarginBounds.Top + m_HeaderHeight + (m_NextRowToPrint == RangeToPrint.Start.Row ? m_TitleHeight : 0),
			                                 e.MarginBounds.Width,
			                                 e.MarginBounds.Height - m_HeaderHeight - (m_NextRowToPrint == RangeToPrint.Start.Row ? m_TitleHeight : 0) - m_FooterHeight);

			this.DrawHeader(e.Graphics, new RectangleF(e.MarginBounds.Left, e.MarginBounds.Top, e.MarginBounds.Width, m_HeaderHeight),
			                m_PageNo, m_PageCount);

			if ( m_PageNo == 1 )
				this.DrawTitle(e.Graphics, new RectangleF(e.MarginBounds.Left, e.MarginBounds.Top + m_HeaderHeight, e.MarginBounds.Width, m_TitleHeight),
				               m_PageNo, m_PageCount);

			List<int> columnHasTopBorder = new List<int>();
			List<int> rowHasLeftBorder = new List<int>();
			RangeCollection printedRanges = new RangeCollection();

			int pageFirstRow = m_NextRowToPrint;
			int pageFirstColumn = m_NextColumnToPrint;
			int pageLastColumn = RangeToPrint.End.Column;

			// Pre-calculate width of the table in current page
			float pageColumnWidth = 0;
			for ( int i = m_NextColumnToPrint; i <= RangeToPrint.End.Column; i++ )
			{
				float colWidth = this.GetColumnWidth(e.Graphics, i);
				if ( i == m_NextColumnToPrint && colWidth > area.Width )
					colWidth = area.Width;
				if ( pageColumnWidth + colWidth <= area.Width )
					pageColumnWidth += colWidth;
				else
					break;
			}

			// Support for fixed row repeat
			if ( RepeatFixedRows && m_Grid.ActualFixedRows > RangeToPrint.Start.Row )
				m_NextRowToPrint = RangeToPrint.Start.Row;

			float curY = area.Top;
			while (m_NextRowToPrint <= RangeToPrint.End.Row)
			{
				// If repeated rows are printed, resume printing next rows
				if ( RepeatFixedRows && m_NextRowToPrint >= m_Grid.ActualFixedRows && m_NextRowToPrint < pageFirstRow )
					m_NextRowToPrint = pageFirstRow;
				float rowHeight = this.GetRowHeight(e.Graphics, m_NextRowToPrint);
				// Check if row fits in current page
				if ( curY + rowHeight > area.Bottom )
					break;
				float curX = area.Left;
				while (m_NextColumnToPrint <= pageLastColumn)
				{
					float colWidth = this.GetColumnWidth(e.Graphics, m_NextColumnToPrint);
					// Check if column fits in current page
					if ( curX + colWidth > area.Right )
					{
						// If single column does not fit in page, force it
						if ( m_NextColumnToPrint == pageFirstColumn )
							colWidth = area.Right - curX;
						else
						{
							pageLastColumn = m_NextColumnToPrint - 1;
							break;
						}
					}
					RectangleF cellRectangle;
					Position pos = new Position(m_NextRowToPrint, m_NextColumnToPrint);
					Range range = m_Grid.PositionToCellRange(pos);

					// Check if cell is spanned
					if ( range.ColumnsCount > 1 || range.RowsCount > 1 )
					{
						Size rangeSize = m_Grid.RangeToSize(range);
						// Is the first position, draw allways
						if ( range.Start == pos )
						{
							cellRectangle = new RectangleF(curX, curY, rangeSize.Width, rangeSize.Height);
							printedRanges.Add(range);
						}
						else
						{
							// Draw only if this cell is not already drawn on current page
							if ( ! printedRanges.ContainsCell(pos) )
							{
//.........这里部分代码省略.........
开发者ID:wsrf2009,项目名称:KnxUiEditor,代码行数:101,代码来源:GridPrintDocument.cs


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