public static GraphicImage CreateFromFile(string filename, int x, int y, int width, int height) { System.Drawing.Image image = System.Drawing.Image.FromFile(filename); IPixelArray pmap = PixelBufferHelper.CreateFromImage(image); GraphicImage gImage = new GraphicImage(filename, x, y, width, height, pmap); return gImage; }
void AddImages() { fProductWheel = GraphicImage.CreateFromResource("Resources.ProductWheel.png", 0, 0, 115, 114); //AddGraphic(fProductWheel); fFeatureWheel = GraphicImage.CreateFromResource("Resources.FeatureWheel.png", 110, 59, 56, 56); //AddGraphic(fFeatureWheel); if (fProductWheel != null) fGraphPort.PixBlt(fProductWheel.Image, fProductWheel.Frame.Left, fProductWheel.Frame.Top); if (fFeatureWheel != null) fGraphPort.PixBlt(fFeatureWheel.Image, fFeatureWheel.Frame.Left, fFeatureWheel.Frame.Top); }
public static GraphicImage CreateFromResource(string resourceName, int x, int y, int width, int height) { System.IO.Stream stream = AppDomain.CurrentDomain.GetType().Assembly.GetManifestResourceStream(resourceName); GraphicImage gImage; if (null != stream) { System.Drawing.Image image = System.Drawing.Image.FromStream(stream); IPixelArray pmap = PixelBufferHelper.CreateFromImage(image); gImage = new GraphicImage(resourceName, x, y, width, height, pmap); } else { gImage = new GraphicImage(resourceName, x, y, width, height, null); } return gImage; }
public static GraphicImage CreateFromBitmap(Bitmap bm, string name, int x, int y, int width, int height) { IPixelArray pbuff = PixelBufferHelper.CreatePixelBufferFromBitmap(bm); GraphicImage gimage = new GraphicImage(name, x, y, width, height, pbuff); return gimage; }