locked
CameraCaptureDialog runs twice--need help RRS feed

  • Question

  • hello, i currently developing a smart device applications in visual studio 2005, in c# using windows mobile 5.0, and .net compact framework 2.0

    i encountered a error that i could not solved.

    that is, when i call the CameraCaptureDialog in my program, if i take a picture or choose to cancel it, the CameraCaptureDialog would not cancel and it would run another time. to sum up, my CameraCaptureDialog run twice and i could not see where the error lies. there's no compiler error or exception.

    here is my codes.

    using Microsoft.WindowsMobile;
    using Microsoft.WindowsMobile.Forms;


            private void Form3_Load(object sender, EventArgs e)
            {
                CameraCaptureDialog camCapture = new CameraCaptureDialog();
                camCapture.InitialDirectory = @"\My Documents\My Pictures";
                camCapture.Mode = CameraCaptureMode.Still;
                camCapture.StillQuality = CameraCaptureStillQuality.High;

              //  camCapture.ShowDialog();

                if (camCapture.ShowDialog() == DialogResult.OK)
                {
                    fileName = camCapture.FileName;    // get filename and create image

                    Show();

                    pictureBoxCamera.Image = new Bitmap(fileName);
                    pictureBoxCamera.SizeMode = PictureBoxSizeMode.StretchImage;

                    camCapture.Dispose();

               

                }
                else
                {
                    this.Close();
                }


            }

    any adcvice is appreciated. thanks in advance
    Thursday, May 31, 2007 6:41 AM

Answers