//// This code is part of Document Solutions for Imaging demos.// Copyright (c) MESCIUS inc. All rights reserved.//usingSystem.IO;usingSystem.Drawing;usingSystem.Linq;usingGrapeCity.Documents.Imaging; namespaceDsImagingWeb.Demos{ // This sample loads the .ICO generated by the MakeIco sample,// and renders all frames found in it along the diagonal of the// resulting image.publicclassReadIco {publicGcBitmapGenerateImage(Size pixelSize, float dpi, bool opaque, string[] sampleParams = null) {int x = 0, y = 0; var srcPath = Path.Combine("Resources", "ImagesBis", "mescius-logomark-c.ico");using (var bmp = newGcBitmap())using (var ico = newGcIco(srcPath)) {var w = ico.Frames.Sum(f_ => f_.Width);var h = ico.Frames.Sum(f_ => f_.Height); bmp.CreateImage(w, h, false); bmp.Clear();for (int i = 0; i < ico.Frames.Count; ++i) {using (var tbmp = ico.Frames[i].ToGcBitmap()) { bmp.BitBlt(tbmp, x, y); x += tbmp.PixelWidth; y += tbmp.PixelHeight; } }return bmp.Clip(newRectangle(0, 0, x, y)); } } }}