⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pre_setav.cs

📁 实现微软OFFICEACCESE数据库自动备份功能
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms ;
using System.Data;
using System.Threading;
using System.Diagnostics;
using gowk.multimedia;

//视频设备设置类
namespace avt
{
    class pre_setav:IDisposable
    {
        public VideoCapturer pre_av;
        private String mb_title;
        private Control con_t;

        public pre_setav(Control control)
        {
            mb_title="视频设置";
            pre_av = new VideoCapturer(control, 0);
            con_t = control;
            //pre_av.SetScale(true);
             
            
        }


        public void ConnectCap()
        {
            if (pre_av != null)
            {
                if (pre_av.Connected == false)
                {
                    pre_av.ConnectDevice();
                }
                else
                {
                    pre_av.Disconnect();
                    pre_av.ConnectDevice();
                }

                    pre_av.SetPreviewRate(66);
                    
                    CaptureParms cp = pre_av.CaptureParms;
                    cp.fCaptureAudio = true;
                    cp.fYield =false ;
                    cp.fAbortRightMouse = cp.fAbortLeftMouse = false;
                    pre_av.CaptureParms = cp;
                    
                    BITMAPINFO h = pre_av.BITMAPINFO;
                    h.bmiHeader.biBitCount = 24;
                    h.bmiHeader.biWidth = 176;
                    h.bmiHeader.biHeight = 144;
                    pre_av.BITMAPINFO = h;
                    
                   

                    

                    pre_av.Preview = true;


                    //pre_av.CaptureWithOutFile();
               
                 
            }
        }

        public void ShowAVFormat()
        {
            ConnectCap();
            if (pre_av.CAPDRIVERCAPS.fHasDlgVideoFormat != 0)
            {
                pre_av.ShowVideoFormat();
            }
            else
            {
                MessageBox.Show("设备不支持该设置!", mb_title, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

            }
        }

         

        public void ShowAVSource()
        {
            ConnectCap();
            if (pre_av.CAPDRIVERCAPS.fHasDlgVideoSource != 0)
            {
                pre_av.ShowVideoSource();
            }
            else
            {
                MessageBox.Show("设备不支持该设置!", mb_title, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }



        }

        public void ShowAVDisPlay()
        {
            ConnectCap();
            if (pre_av.CAPDRIVERCAPS.fHasDlgVideoDisplay != 0)
            {
                pre_av.ShowVideoDisplay();
            }
            else
            {

                MessageBox.Show("设备不支持该设置!", mb_title, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

            }


        }

        public void ShowAVCompression()
        {
            pre_av.ShowVideoCompression();


        }

        



        #region IDisposable 成员

        public void Dispose()
        {
            pre_av.Disconnect();
            pre_av.Close();
        }

        #endregion
    };



    //多线程视频设置,以减轻主线程负担
    class pre_thr_set : IDisposable
    {
        pre_setav setav;
        public pre_thr_set(Control con)
        {
            setav = new pre_setav(con);
            
        }

        public void ShowSource()
        {
            Thread thr = new Thread(new ThreadStart(setav.ShowAVSource));
            thr.Start();

        }
        public void ShowFormat()
        {
            Thread thr = new Thread(new ThreadStart(setav.ShowAVFormat));
            thr.Start();

        }
        public void ShowDisPlay()
        {
            Thread thr = new Thread(new ThreadStart(setav.ShowAVDisPlay));
            thr.Start();

        }
        public void ShowCompression()
        {
            Thread thr = new Thread(new ThreadStart(setav.ShowAVCompression));
            thr.Start();

        }

        public void IniAV()
        {
            Thread thr = new Thread(new ThreadStart(setav.ConnectCap));
            thr.Start();
            Debug.Print("ini!!!!!!!!!!!!!!");
            
        }
        public int GetBitmapWidth()
        {
            return this.setav.pre_av.BITMAPINFO.bmiHeader.biWidth;
        }
        public int GetBitmapHeight()
        {
            return this.setav.pre_av.BITMAPINFO.bmiHeader.biHeight;
        }


        #region IDisposable 成员

        public void Dispose()
        {
            //throw new Exception("The method or operation is not implemented.");
            setav.Dispose();
        }

        #endregion
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -