Skip to content

Instantly share code, notes, and snippets.

@Stasonix
Created July 26, 2012 08:34
Show Gist options
  • Save Stasonix/3180995 to your computer and use it in GitHub Desktop.
Save Stasonix/3180995 to your computer and use it in GitHub Desktop.
Test IMG project (SO) doimg.cs
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
{
static class doimg
{
static Color[] clr = new Color[] { Color.Red, Color.Blue, Color.Black, Color.Violet, Color.Wheat };
static int count = 0;
static public Bitmap picture()
{
// some staffs to get a picture, so it's in bmp object now.
Bitmap bmp = new Bitmap(200, 200, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
// Added some drawing to bitmap to test functionality
Graphics gfx = Graphics.FromImage(bmp);
gfx.FillEllipse(new SolidBrush(clr[count]), new Rectangle(0, 0, 199, 199));
gfx.Dispose();
if (count >= 4)
count = 0;
else
count += 1;
return bmp;
}
// this test must also draw something on a form which is active/not active, no difference.
static public void test()
{
doimg.picture();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment