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);
g.DrawImage(mybitmap, 0, 0, DRAW_WIDTH, DRAW_HEIGHT);

How do we write the DRAW_WIDTH, DRAW_HEIGHT?

DRAW_WIDTH, DRAW_HEIGHT are the width and height of your bitmap.

can give me a example of the coding ? Kind of confused ..

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();
        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.