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

Re: creating a mouase click event for a button at run time 80 80

have a read through this article:

http://msdn.microsoft.com/en-us/library/dfty2w4e(VS.80).aspx

Re: creating a mouase click event for a button at run time 80 80

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);
        }
Re: creating a mouase click event for a button at run time 80 80

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 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.