/// <summary> /// Создание массива BMP из СГР : на каждую строку - отдельная BMP. /// </summary> /// <param name="ppi">Разрешение</param> /// <returns>Bitmap</returns> internal Bitmap[] PrepareSlicedBMP(Int32 ppi) { var vPack = new RowsPack(dPack); vPack.Prepare(dPack, ppi); var bmp = new Bitmap(vPack.Width, vPack.Heght); bmp.SetResolution(ppi, ppi); using (Graphics gfx = Graphics.FromImage(bmp)) { gfx.Clear(Color.White); // Очищаем экран gfx.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; gfx.PageUnit = GraphicsUnit.Pixel; vPack.DrawRows(gfx); } var arrBmp = new Bitmap[vPack.RowCount]; var arrYs = vPack.GetRowsHeights(); var startY = Constants.marginY + Constants.captionH; for (Int32 i = 0; i < arrYs.Length; i++) { arrBmp[i] = bmp.Clone(new Rectangle(0, startY, bmp.Width, arrYs[i]), bmp.PixelFormat); startY += arrYs[i]; } return(arrBmp); }
/// <summary> /// Создание картинки СГР /// </summary> /// <param name="ppi">Разрешение</param> /// <returns>Bitmap</returns> internal Bitmap PrepareBMP(Int32 ppi) { var vPack = new RowsPack(dPack); vPack.Prepare(dPack, ppi); var bmp = new Bitmap(vPack.Width, vPack.Heght); bmp.SetResolution(ppi, ppi); using (Graphics gfx = Graphics.FromImage(bmp)) { gfx.Clear(Color.White); // Очищаем экран gfx.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; gfx.PageUnit = GraphicsUnit.Pixel; //DrawGrid(gfx); //vPack.DrawShablon(gfx); vPack.DrawRows(gfx); } return(bmp); }