public void Render(Bitmap[] images, float left, float top, float right, float bottom) { images = (images ?? new Bitmap[0]).Select(i => ((Bitmap)i.Clone()).ScaleTo(PrintBounds.Size)).ToArray(); if (!images.Any()) return; var scanStart = Horizontal ? top : left; var scanEnd = Horizontal ? bottom : right; var lineStart = Horizontal ? left : top; var lineEnd = Horizontal ? right : bottom; var scanSize = Dpi/Lpi; var scanStep = scanSize/images.Length; var pens = images.Select(i => new Pen(new TextureBrush(i), scanStep)).ToArray(); for (var position = scanStart; position < scanEnd; position += scanStep * pens.Length) for (var index = 0; index < pens.Length; index++) { var pen = pens[index]; var offset = scanStep*index; RenderLine(_context.Graphics, pen, position + offset, lineStart, lineEnd); } pens.ToList().ForEach(p => p.Dispose()); images.ToList().ForEach(i => i.Dispose()); }
public static ScintillaNet.Scintilla ApplyImageList(ScintillaNet.Scintilla scinti) { Bitmap[] bmList = new Bitmap[imgList.Count]; foreach (KeyValuePair<int, Bitmap> i in imgList) { bmList[i.Key] = i.Value; } scinti.AutoComplete.RegisterImages(bmList.ToList<Bitmap>()); return scinti; }