Skip to content

Instantly share code, notes, and snippets.

@Stasonix
Created July 26, 2012 07:16
Show Gist options
  • Save Stasonix/3180714 to your computer and use it in GitHub Desktop.
Save Stasonix/3180714 to your computer and use it in GitHub Desktop.
Test IMG project
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Printing;
namespace testimg
{
class doimg
{
public void picture(Form form) //рисуй там где хочешь
{
int x, y;
// some staffs to get a picture, so it's in bmp object now.
// I added some color to the Bitmap so I could see if it was there or not
// How ever you draw the Image just return the Bitmap to the calling function.
Bitmap bmp = new Bitmap(200, 200, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
for (x = 0; x < 200; x++)
for (y = 0; y < 200; y++)
bmp.SetPixel(x, y, Color.Red);
Graphics gfx = Graphics.FromImage(bmp);
gfx = form.CreateGraphics(); // works well with active form
gfx.DrawImage(bmp, 0, 0);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment