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


C# GridVirtual.PositionToCellRange方法代码示例

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


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

示例1: Export

        public virtual void Export(GridVirtual grid, System.Drawing.Graphics graphics, 
                                Range rangeToExport, System.Drawing.Point destinationLocation)
        {
            if (rangeToExport.IsEmpty())
                return;

            System.Drawing.Point cellPoint = destinationLocation;

            System.Drawing.Point deltaPoint = destinationLocation;

            using (DevAge.Drawing.GraphicsCache graphicsCache = new DevAge.Drawing.GraphicsCache(graphics))
            {
                for (int r = rangeToExport.Start.Row; r <= rangeToExport.End.Row; r++)
                {
                    int rowHeight = grid.Rows.GetHeight(r);

                    for (int c = rangeToExport.Start.Column; c <= rangeToExport.End.Column; c++)
                    {
                        Rectangle cellRectangle;
                        Position pos = new Position(r, c);

                        Size cellSize = new Size(grid.Columns.GetWidth(c), rowHeight);

                        Range range = grid.PositionToCellRange(pos);

                        //support for RowSpan or ColSpan
                        //Note: for now I draw only the merged cell at the first position
                        // (this can cause a problem if you export partial range that contains a partial merged cells)
                        if ( range.ColumnsCount > 1 || range.RowsCount > 1)
                        {
                            //Is the first position
                            if (range.Start == pos)
                            {
                                Size rangeSize = grid.RangeToSize(range);

                                cellRectangle = new Rectangle(cellPoint,
                                                              rangeSize);
                            }
                            else
                                cellRectangle = Rectangle.Empty;
                        }
                        else
                        {
                            cellRectangle = new Rectangle(cellPoint, cellSize);
                        }

                        if (cellRectangle.IsEmpty == false)
                        {
                            Cells.ICellVirtual cell = grid.GetCell(pos);
                            CellContext context = new CellContext(grid, pos, cell);
                            ExportCell(context, graphicsCache, cellRectangle);
                        }

                        cellPoint = new Point(cellPoint.X + cellSize.Width, cellPoint.Y);
                    }

                    cellPoint = new Point(destinationLocation.X, cellPoint.Y + rowHeight);
                }
            }
        }
开发者ID:zhuangyy,项目名称:Motion,代码行数:60,代码来源:Image.cs

示例2: SetHeight

 private void SetHeight(GridVirtual grid, Position position, int height)
 {
     Range range = grid.PositionToCellRange(position);
     int heightForCol = height / range.RowsCount;
     for (int r = range.Start.Row; r <= range.End.Row; r++)
         grid.Rows.SetHeight(r, heightForCol);
 }
开发者ID:wsrf2009,项目名称:KnxUiEditor,代码行数:7,代码来源:Resizable.cs

示例3: SetWidth

 private void SetWidth(GridVirtual grid, Position position, int width)
 {
     Range range = grid.PositionToCellRange(position);
     int widthForCol = width / range.ColumnsCount;
     for (int c = range.Start.Column; c <= range.End.Column; c++)
         grid.Columns.SetWidth(c, widthForCol);
 }
开发者ID:wsrf2009,项目名称:KnxUiEditor,代码行数:7,代码来源:Resizable.cs


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