0

Can i have a sample of the coding for it ?

  private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
    {

        mybitmap = new Bitmap(pictureBox1.Image);

        // In the mouse move event
        var pixelcolor = mybitmap.GetPixel(e.X, e.Y);
        // Displays R  / G / B Color


        Graphics g = pictureBox1.CreateGraphics();
        g.DrawRectangle(new Pen(Brushes.Blue), 150, 150, 60, 60);
3
Contributors
5
Replies
19
Views
4 Years
Discussion Span
Last Post by ddanbe
0

Something like this?

 private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
        {
            Bitmap mybitmap = new Bitmap(pictureBox1.Image);
            Color pixelcolor = mybitmap.GetPixel(e.X, e.Y);
            MessageBox.Show("R = " + pixelcolor.R.ToString() + 
                "  G = " + pixelcolor.G.ToString() + 
                "  B = " + pixelcolor.B.ToString());

            Graphics g = CreateGraphics();
            g.DrawImage(mybitmap, 100, 100);//100:X & Y coordinates of top left
            g.Dispose();
        }

Edited by ddanbe

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.