public Bitmap GetBitmap(int x, int y, int dx, int dy, Color bColor) { Bitmap bmp = new Bitmap(dx, dy); Graphics g = Graphics.FromImage(bmp); g.Clear(bColor); g.Dispose(); if (!File.Exists(FileName)) { return(bmp); } FileStream fs = null; try { fs = File.Open(FileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); for (int iy = 0; iy < dy; iy++) { int jy = y + iy; if (jy < 0) { continue; } string fileLine = ""; fs.Seek(linePositions[jy], SeekOrigin.Begin); byte[] buffer = new byte[lineLengths[jy]]; fs.Read(buffer, 0, buffer.Length); StringBuilder sb = new StringBuilder(); foreach (byte b in buffer) { sb.Append((char)b); } fileLine = sb.ToString(); string[] ss = fileLine.Split(c_Split); for (int ix = 0; ix < dx; ix++) { int jx = x + ix; if (jx < 0) { continue; } if (jx >= ss.Length) { break; } bmp.SetPixel(ix, iy, Slide.GetColor(ss[jx])); } } } catch (Exception) { } finally { if (fs != null) { fs.Close(); } } return(bmp); }
/// <summary> /// Constructor, creates the image description /// </summary> /// <param name="Parent"></param> /// <param name="args"></param> public SlideComponentLabelOver(Slide Parent, string[] args) : base(Parent, args) { }