예제 #1
0
        private void CameraGrabberSaveImageComplete(
            IntPtr Grabber,
            IntPtr Image,       // 需要调用CameraImage_Destroy释放
            CameraSdkStatus Status,
            IntPtr Context)
        {
            if (Image != IntPtr.Zero)
            {
                string filename = System.IO.Path.Combine(
                    AppDomain.CurrentDomain.BaseDirectory.ToString(),
                    string.Format("{0}.bmp", System.Environment.TickCount));

                MvApi.CameraImage_SaveAsBmp(Image, filename);

                MessageBox.Show(filename);
            }

            MvApi.CameraImage_Destroy(Image);
        }
예제 #2
0
        private void buttonSnap_Click(object sender, EventArgs e)
        {
            if (m_Grabber != IntPtr.Zero)
            {
                IntPtr Image;
                if (MvApi.CameraGrabber_SaveImage(m_Grabber, out Image, 2000) == CameraSdkStatus.CAMERA_STATUS_SUCCESS)
                {
                    string filename = System.IO.Path.Combine(
                        AppDomain.CurrentDomain.BaseDirectory.ToString(),
                        string.Format("{0}.bmp", System.Environment.TickCount));

                    MvApi.CameraImage_SaveAsBmp(Image, filename);

                    MvApi.CameraImage_Destroy(Image);

                    MessageBox.Show(filename);
                }
                else
                {
                    MessageBox.Show("Snap failed");
                }
            }
        }