Hi,
In my current project,
Am drawing a set of boxes, all at run time, and inside them i have called few bitmap images for each box, this also happens at run time.
now i need to click that image, the image should be selected and that image shud appear as if the pixels are inversed.
HOw do i create a button click event for that image which is been called at run time..?

Plz help me out with this...

thanks in advance...

Hi,
In my current project,
Am drawing a set of boxes, all at run time, and inside them i have called few bitmap images for each box, this also happens at run time.
now i need to click that image, the image should be selected and that image shud appear as if the pixels are inversed.
HOw do i create a button click event for that image which is been called at run time..?

Plz help me out with this...

thanks in advance...

If you are creating a control (like PictureBox ) for each of the set of boxes, then you could create one click event that is wired to each of the controls at runtime:

void HandleMyBoxes_Click(object sender, EventArgs e)
        {
            PictureBox pb = sender as PictureBox;

            // .... Code to Invert the pb.Image
        }

        void CreateBox(Point pt)
        {
            PictureBox pb = new PictureBox();
            
            //.... Code to Add your bitmap object and position your control

            // Add click Event at runtime
            pb.Click += new System.EventHandler(HandleMyBoxes_Click);
        }

Hey, thanks a lot frnds..
I figured it out in my office today...
thanks a lot.

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.