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


C# GridVirtual.RangeToSize方法代码示例

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


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

示例1: Export

        public virtual System.Drawing.Bitmap Export(GridVirtual grid, Range rangeToExport)
        {
            System.Drawing.Bitmap bitmap = null;

            try
            {
                System.Drawing.Size size = grid.RangeToSize(rangeToExport);

                bitmap = new System.Drawing.Bitmap(size.Width, size.Height);

                using (System.Drawing.Graphics graphic = System.Drawing.Graphics.FromImage(bitmap))
                {
                    Export(grid, graphic, rangeToExport, new System.Drawing.Point(0, 0));
                }
            }
            catch (Exception)
            {
                if (bitmap != null)
                {
                    bitmap.Dispose();
                    bitmap = null;
                }

                throw;
            }

            return bitmap;
        }
开发者ID:wsrf2009,项目名称:KnxUiEditor,代码行数:28,代码来源:Image.cs

示例2: 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


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