Пример #1
0
        // Tracks the mouse and magnifies the current pixel.
        private void pictureDisplay_MouseMove(object sender, EventArgs e)
        {
            if (imageLoaded)
            {
                // Get mouse coordinates relative to the pictureBox.
                MouseEventArgs me = (MouseEventArgs)e;
                int            x  = me.Location.X;
                int            y  = me.Location.Y;

                // Get the color of the pixel clicked.
                Color       pixel = originalImage.GetPixel(x, y);
                DRGBNcolors color = new DRGBNcolors();

                Bitmap pixelImage = new Bitmap(20, 20);

                // Copy the color to a larger box.
                for (int i = 0; i < 20; i++)
                {
                    for (int j = 0; j < 20; j++)
                    {
                        pixelImage.SetPixel(i, j, pixel);
                    }
                }

                pixelBox.Image = pixelImage;

                Point m = new Point(this.pictureDisplay.Location.X + x + 1, this.pictureDisplay.Location.Y + y + 1);
                pixelBox.Location = m;

                pixelBox.Visible = true;
            }
        }
Пример #2
0
        /* Beginning of image interaction functions.*/

        // Clicking on the image pops out a box displaying what the color is or is most similar to.
        private void pictureDisplay_Click(object sender, EventArgs e)
        {
            if (imageLoaded)
            {
                // Get mouse coordinates relative to the pictureBox.
                MouseEventArgs me = (MouseEventArgs)e;
                int            x  = me.Location.X;
                int            y  = me.Location.Y;

                Color       pixel = originalImage.GetPixel(x, y);
                DRGBNcolors color = new DRGBNcolors();
                color.findColor(pixel.R, pixel.G, pixel.B, this.Location.X + this.pictureDisplay.Location.X + x,
                                this.Location.Y + this.pictureDisplay.Location.Y + y);
            }
        }
Пример #3
0
        // Tracks the mouse and magnifies the current pixel.
        private void pictureDisplay_MouseMove(object sender, EventArgs e)
        {
            if (imageLoaded)
            {
                // Get mouse coordinates relative to the pictureBox.
                MouseEventArgs me = (MouseEventArgs)e;
                int x = me.Location.X;
                int y = me.Location.Y;

                // Get the color of the pixel clicked.
                Color pixel = originalImage.GetPixel(x, y);
                DRGBNcolors color = new DRGBNcolors();

                Bitmap pixelImage = new Bitmap(20, 20);

                // Copy the color to a larger box.
                for (int i = 0; i < 20; i++)
                {
                    for (int j = 0; j < 20; j++)
                    {
                        pixelImage.SetPixel(i, j, pixel);
                    }
                }

                pixelBox.Image = pixelImage;

                Point m = new Point(this.pictureDisplay.Location.X + x + 1, this.pictureDisplay.Location.Y + y + 1);
                pixelBox.Location = m;

                pixelBox.Visible = true;
            }
        }
Пример #4
0
        /* Beginning of image interaction functions.*/
        // Clicking on the image pops out a box displaying what the color is or is most similar to.
        private void pictureDisplay_Click(object sender, EventArgs e)
        {
            if (imageLoaded)
            {
                // Get mouse coordinates relative to the pictureBox.
                MouseEventArgs me = (MouseEventArgs)e;
                int x = me.Location.X;
                int y = me.Location.Y;

                Color pixel = originalImage.GetPixel(x, y);
                DRGBNcolors color = new DRGBNcolors();
                color.findColor(pixel.R, pixel.G, pixel.B, this.Location.X + this.pictureDisplay.Location.X + x,
                    this.Location.Y + this.pictureDisplay.Location.Y + y);
            }
        }