void im_Click(object sender, EventArgs e) { ImageMagnifier.ImageMagnifier im = (ImageMagnifier.ImageMagnifier)sender; this.imNNState.ImageToMagnify = im.ImageToMagnify; frmAddDistortion frmaddDistortion = new frmAddDistortion(); frmaddDistortion.ShowDialog(); Random r = new Random(); int p = 0; int k = 0; for (int i = 0; i < frmaddDistortion.DistortionLevel; i++) { p = r.Next(imageDim); k = r.Next(imageDim); if (imNNState.pixels[k, p] == Color.Black.ToArgb()) { imNNState.pixels[k, p] = Color.White.ToArgb(); } else if (imNNState.pixels[k, p] == Color.White.ToArgb()) { imNNState.pixels[k, p] = Color.Black.ToArgb(); } } lblEnergy.Text = "0"; patternSelected = true; imNNState.Invalidate(); }
void im_Click(object sender, EventArgs e) { ImageMagnifier.ImageMagnifier im = (ImageMagnifier.ImageMagnifier)sender; this.imNNState.ImageToMagnify = im.ImageToMagnify; frmAddDistortion frmaddDistortion = new frmAddDistortion(); frmaddDistortion.ShowDialog(); Random r = new Random(); int p=0; int k=0; for (int i = 0; i < frmaddDistortion.DistortionLevel; i++) { p = r.Next(imageDim); k = r.Next(imageDim); if (imNNState.pixels[k, p] == Color.Black.ToArgb()) imNNState.pixels[k, p] = Color.White.ToArgb(); else if (imNNState.pixels[k, p] == Color.White.ToArgb()) imNNState.pixels[k, p] = Color.Black.ToArgb(); } lblEnergy.Text = "0"; patternSelected = true; imNNState.Invalidate(); }