0

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...

3
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by arunkumars
0

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);
        }
This question has already been answered. 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.