private void pictureBox_MouseUp(object sender, MouseEventArgs e)
{
if (drawing > 0)
{
int x = (int)((float)e.X * (float)PATTERN_WIDTH / (float)pictureBox.Width);
int y = (int)((float)e.Y * (float)PATTERN_WIDTH / (float)pictureBox.Height);
if (x >= 0 && x < PATTERN_WIDTH && y >= 0 && y < PATTERN_WIDTH)
{
if (drawing == 1) mCurrentImage.SetPixel(x, y, Color.Black);
else if (drawing == 2) mCurrentImage.SetPixel(x, y, Color.White);
setImage(mCurrentImage);
}
}
drawing = 0;
}