• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# CaptureType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中CaptureType的典型用法代码示例。如果您正苦于以下问题:C# CaptureType类的具体用法?C# CaptureType怎么用?C# CaptureType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CaptureType类属于命名空间,在下文中一共展示了CaptureType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Capture

        public override void Capture(CaptureType captureType, TaskSettings taskSettings, bool autoHideForm = true)
        {
            DoCapture(() =>
            {
                Image img;
                string activeWindowTitle = NativeMethods.GetForegroundWindowText();
                string activeProcessName = null;

                using (Process process = NativeMethods.GetForegroundWindowProcess())
                {
                    if (process != null)
                    {
                        activeProcessName = process.ProcessName;
                    }
                }

                if (taskSettings.CaptureSettings.CaptureTransparent && !taskSettings.CaptureSettings.CaptureClientArea)
                {
                    img = Screenshot.CaptureActiveWindowTransparent();
                }
                else
                {
                    img = Screenshot.CaptureActiveWindow();
                }

                img.Tag = new ImageTag
                {
                    ActiveWindowTitle = activeWindowTitle,
                    ActiveProcessName = activeProcessName
                };

                return img;
            }, CaptureType.ActiveWindow, taskSettings, autoHideForm);
        }
开发者ID:harley1011,项目名称:ShareX,代码行数:34,代码来源:CaptureActiveWindow.cs


示例2: CaptureScreenshot

        public static void CaptureScreenshot(CaptureType captureType, TaskSettings taskSettings = null, bool autoHideForm = true)
        {
            if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();

            switch (captureType)
            {
                case CaptureType.Fullscreen:
                    DoCapture(TaskHelpers.GetScreenshot(taskSettings).CaptureFullscreen, CaptureType.Fullscreen, taskSettings, autoHideForm);
                    break;
                case CaptureType.ActiveWindow:
                    CaptureActiveWindow(taskSettings, autoHideForm);
                    break;
                case CaptureType.ActiveMonitor:
                    DoCapture(TaskHelpers.GetScreenshot(taskSettings).CaptureActiveMonitor, CaptureType.ActiveMonitor, taskSettings, autoHideForm);
                    break;
                case CaptureType.Region:
                    CaptureRegion(taskSettings, autoHideForm);
                    break;
                case CaptureType.CustomRegion:
                    CaptureCustomRegion(taskSettings, autoHideForm);
                    break;
                case CaptureType.LastRegion:
                    CaptureLastRegion(taskSettings, autoHideForm);
                    break;
            }
        }
开发者ID:L1Q,项目名称:ShareX,代码行数:26,代码来源:CaptureTaskHelpers.cs


示例3: CaptureScreenshot

        public void CaptureScreenshot(CaptureType captureType, TaskSettings taskSettings = null, bool autoHideForm = true)
        {
            if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();

            switch (captureType)
            {
                case CaptureType.Screen:
                    DoCapture(Screenshot.CaptureFullscreen, CaptureType.Screen, taskSettings, autoHideForm);
                    break;
                case CaptureType.ActiveWindow:
                    CaptureActiveWindow(taskSettings, autoHideForm);
                    break;
                case CaptureType.ActiveMonitor:
                    DoCapture(Screenshot.CaptureActiveMonitor, CaptureType.ActiveMonitor, taskSettings, autoHideForm);
                    break;
                case CaptureType.Rectangle:
                case CaptureType.RectangleWindow:
                case CaptureType.RoundedRectangle:
                case CaptureType.Ellipse:
                case CaptureType.Triangle:
                case CaptureType.Diamond:
                case CaptureType.Polygon:
                case CaptureType.Freehand:
                    CaptureRegion(captureType, taskSettings, autoHideForm);
                    break;
                case CaptureType.LastRegion:
                    CaptureLastRegion(taskSettings, autoHideForm);
                    break;
            }
        }
开发者ID:jakesyl,项目名称:ShareX,代码行数:30,代码来源:MainForm_Capture.cs


示例4: GetStrategy

        public CaptureStrategy GetStrategy(CaptureType captureType, MainForm mainForm)
        {
            CaptureStrategy strategy = null;

            switch (captureType)
            {
                case CaptureType.Screen:
                    strategy = new CaptureScreen(mainForm);
                    break;
                case CaptureType.ActiveWindow:
                    strategy = new CaptureActiveWindow(mainForm);
                    break;
                case CaptureType.ActiveMonitor:
                    strategy = new CaptureActiveMonitor(mainForm);
                    break;
                case CaptureType.Rectangle:
                case CaptureType.RectangleWindow:
                case CaptureType.Polygon:
                case CaptureType.Freehand:
                    strategy = new CaptureRegion(mainForm);
                    break;
                case CaptureType.CustomRegion:
                    strategy = new CaptureCustomRegion(mainForm);
                    break;
                case CaptureType.LastRegion:
                    strategy = new CaptureLastRegion(mainForm);
                    break;
            }
            return strategy;
        }
开发者ID:harley1011,项目名称:ShareX,代码行数:30,代码来源:CaptureFactory.cs


示例5: ParseHidReport

 protected override void ParseHidReport(byte[] report)
 {
     if (Capture != CaptureType.Default)
     {
         _dumper.DumpArray(Capture.ToString(), report, report.Length);
         Capture = CaptureType.Default;
     }
 }
开发者ID:CheesyKek,项目名称:ScpToolkit,代码行数:8,代码来源:UsbBlankGamepad.cs


示例6: Capture

        public override void Capture(CaptureType captureType, TaskSettings taskSettings, bool autoHideForm = true)
        {
            DoCapture(() =>
            {
                Rectangle regionBounds = taskSettings.CaptureSettings.CaptureCustomRegion;
                Image img = Screenshot.CaptureRectangle(regionBounds);

                return img;
            }, CaptureType.CustomRegion, taskSettings, autoHideForm);
        }
开发者ID:harley1011,项目名称:ShareX,代码行数:10,代码来源:CaptureCustomRegion.cs


示例7: VideoCapture

        /// <summary>
        /// 空の状態で初期化. 後でOpenが必要.
        /// </summary>
        /// <returns></returns>
#else
        /// <summary>
        /// Initializes empty capture.
        /// To use this, you should call Open. 
        /// </summary>
        /// <returns></returns>
#endif
        public VideoCapture()
        {
            try
            {
                ptr = NativeMethods.videoio_VideoCapture_new1();
            }
            catch (AccessViolationException e)
            {
                throw new OpenCvSharpException("Failed to create VideoCapture", e);
            }
            if (ptr == IntPtr.Zero)
                throw new OpenCvSharpException("Failed to create VideoCapture");
            
            captureType = CaptureType.NotSpecified;
        }
开发者ID:Bobanaut,项目名称:opencvsharp,代码行数:26,代码来源:VideoCapture.cs


示例8: CvCapture

        /// <summary>
        /// カメラからのビデオキャプチャを初期化する.
        /// Windows では,次の二つのカメラインタフェースが利用できる:Video for Windows(VFW),Matrox Imaging Library(MIL). 
        /// Linux では,次の二つカメラインタフェースが利用できる:Video for Linux(V4L),FireWire(IEEE1394). 
        /// </summary>
        /// <param name="index">使われるカメラのインデックス.使用するカメラが1台のとき,あるいは,何台のカメラを使うかが重要でないときは,-1 でも問題ない場合もある.</param>
        /// <returns></returns>
#else
        /// <summary>
        /// Allocates and initialized the CvCapture structure for reading a video stream from the camera. 
        /// Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394).
        /// </summary>
        /// <param name="index">Index of the camera to be used. If there is only one camera or it does not matter what camera to use -1 may be passed. </param>
        /// <returns></returns>
#endif
        public CvCapture(int index)
        {
            try
            {
                this._ptr = CvInvoke.cvCreateCameraCapture(index);
            }
            catch (AccessViolationException e)
            {
                throw new OpenCvSharpException("Failed to create CvCapture", e);
            }
            if (this._ptr == IntPtr.Zero)
            {
                throw new OpenCvSharpException("Failed to create CvCapture");
            }
            this._captureType = CaptureType.Camera;
        }
开发者ID:sanglin307,项目名称:UnityOpenCV,代码行数:31,代码来源:CvCapture.cs


示例9: CvCapture

        /// <summary>
        /// カメラからのビデオキャプチャを初期化する.
        /// Windows では,次の二つのカメラインタフェースが利用できる:Video for Windows(VFW),Matrox Imaging Library(MIL). 
        /// Linux では,次の二つカメラインタフェースが利用できる:Video for Linux(V4L),FireWire(IEEE1394). 
        /// </summary>
        /// <param name="index">使われるカメラのインデックス.使用するカメラが1台のとき,あるいは,何台のカメラを使うかが重要でないときは,-1 でも問題ない場合もある.</param>
        /// <returns></returns>
#else
        /// <summary>
        /// Allocates and initialized the CvCapture structure for reading a video stream from the camera. 
        /// Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394).
        /// </summary>
        /// <param name="index">Index of the camera to be used. If there is only one camera or it does not matter what camera to use -1 may be passed. </param>
        /// <returns></returns>
#endif
        public CvCapture(int index)
        {
            try
            {
                ptr = NativeMethods.cvCreateCameraCapture(index);
            }
            catch (AccessViolationException e)
            {
                throw new OpenCvSharpException("Failed to create CvCapture", e);
            }

            if (ptr == IntPtr.Zero)
                throw new OpenCvSharpException("Failed to create CvCapture");
            
            captureType = CaptureType.Camera;
        }
开发者ID:0sv,项目名称:opencvsharp,代码行数:31,代码来源:CvCapture.cs


示例10: Capture

 public static Image Capture(CaptureType type, Point origin = default(Point), Size size = default(Size), IntPtr handle = default(IntPtr))
 {
     Image result;
     switch (type) {
         case CaptureType.Range:
             result = CaptureRange(origin, size);
             break;
         case CaptureType.Window:
             result = CaptureWindow(handle);
             break;
         default:
             result = CaptureFullScreen();
             break;
     }
     Clipboard.SetImage(result);
     return result;
 }
开发者ID:curtisrutland,项目名称:ScreenGrabber,代码行数:17,代码来源:ScreenCapture.cs


示例11: ExecuteJob

        private async void ExecuteJob(CaptureType captureType, bool withDelay)
        {
            if (withDelay)
                await Task.Delay(250);

            switch (captureType)
            {
                case CaptureType.PrintScreen:
                    DoCaptureWork(Screenshot.CaptureFullscreen);
                    break;
                case CaptureType.ActiveWindow:
                    DoCaptureWork(Screenshot.CaptureActiveWindow);
                    break;
                case CaptureType.Rectangle:
                    DoCaptureWork(CaptureRectangle);
                    break;
            }
        }
开发者ID:CrazyJo,项目名称:ScreenShotShooter,代码行数:18,代码来源:ScreenShotEngine.cs


示例12: DoCapture

        public static void DoCapture(ScreenCaptureDelegate capture, CaptureType captureType, TaskSettings taskSettings = null, bool autoHideForm = true)
        {
            if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();

            if (taskSettings.CaptureSettings.IsDelayScreenshot && taskSettings.CaptureSettings.DelayScreenshot > 0)
            {
                TaskEx.Run(() =>
                {
                    int sleep = (int)(taskSettings.CaptureSettings.DelayScreenshot * 1000);
                    Thread.Sleep(sleep);
                },
                () =>
                {
                    DoCaptureWork(capture, captureType, taskSettings, autoHideForm);
                });
            }
            else
            {
                DoCaptureWork(capture, captureType, taskSettings, autoHideForm);
            }
        }
开发者ID:L1Q,项目名称:ShareX,代码行数:21,代码来源:CaptureTaskHelpers.cs


示例13: AfterCapture

        protected void AfterCapture(Image img, CaptureType captureType, TaskSettings taskSettings)
        {
            if (img != null)
            {
                if (taskSettings.GeneralSettings.PlaySoundAfterCapture)
                {
                    TaskHelpers.PlayCaptureSound(taskSettings);
                }

                if (taskSettings.ImageSettings.ImageEffectOnlyRegionCapture && !IsRegionCapture(captureType))
                {
                    taskSettings.AfterCaptureJob = taskSettings.AfterCaptureJob.Remove(AfterCaptureTasks.AddImageEffects);
                }

                string customFileName;

                if (TaskHelpers.ShowAfterCaptureForm(taskSettings, out customFileName, img))
                {
                    UploadManager.RunImageTask(img, taskSettings, customFileName);
                }
            }
        }
开发者ID:harley1011,项目名称:ShareX,代码行数:22,代码来源:CaptureStrategy.cs


示例14: AfterCapture

        private void AfterCapture(Image img, CaptureType captureType, TaskSettings taskSettings)
        {
            if (img != null)
            {
                if (taskSettings.GeneralSettings.PlaySoundAfterCapture)
                {
                    Helpers.PlaySoundAsync(Resources.CameraSound);
                }

                if (taskSettings.ImageSettings.ImageEffectOnlyRegionCapture && !IsRegionCapture(captureType))
                {
                    taskSettings.AfterCaptureJob = taskSettings.AfterCaptureJob.Remove(AfterCaptureTasks.AddImageEffects);
                }

                if (taskSettings.GeneralSettings.ShowAfterCaptureTasksForm)
                {
                    using (AfterCaptureForm afterCaptureForm = new AfterCaptureForm(img, taskSettings))
                    {
                        afterCaptureForm.ShowDialog();

                        switch (afterCaptureForm.Result)
                        {
                            case AfterCaptureFormResult.Continue:
                                taskSettings.AfterCaptureJob = afterCaptureForm.AfterCaptureTasks;
                                break;
                            case AfterCaptureFormResult.Copy:
                                taskSettings.AfterCaptureJob = AfterCaptureTasks.CopyImageToClipboard;
                                break;
                            case AfterCaptureFormResult.Cancel:
                                if (img != null) img.Dispose();
                                return;
                        }
                    }
                }

                UploadManager.RunImageTask(img, taskSettings);
            }
        }
开发者ID:kennethisom,项目名称:ShareX,代码行数:38,代码来源:MainForm_Capture.cs


示例15: Open

        /// <summary>
        /// カメラからのビデオキャプチャを初期化する.
        /// Windows では,次の二つのカメラインタフェースが利用できる:Video for Windows(VFW),Matrox Imaging Library(MIL). 
        /// Linux では,次の二つカメラインタフェースが利用できる:Video for Linux(V4L),FireWire(IEEE1394). 
        /// </summary>
        /// <param name="index">使われるカメラのインデックス.使用するカメラが1台のとき,あるいは,何台のカメラを使うかが重要でないときは,-1 でも問題ない場合もある.</param>
        /// <returns></returns>
#else
        /// <summary>
        /// Allocates and initialized the CvCapture structure for reading a video stream from the camera. 
        /// Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394).
        /// </summary>
        /// <param name="index">Index of the camera to be used. If there is only one camera or it does not matter what camera to use -1 may be passed. </param>
        /// <returns></returns>
#endif
        public void Open(int index)
        {
            ThrowIfDisposed();
            try
            {
                NativeMethods.videoio_VideoCapture_open2(ptr, index);
            }
            catch (AccessViolationException e)
            {
                throw new OpenCvSharpException("Failed to create CvCapture", e);
            }
            captureType = CaptureType.Camera;
        }
开发者ID:Bobanaut,项目名称:opencvsharp,代码行数:28,代码来源:VideoCapture.cs


示例16: Capture

        public virtual Bitmap[] Capture(CaptureType typeOfCapture)
        {
            Bitmap memoryImage;
            int count = 1;

            try
            {
                Screen[] screens = Screen.AllScreens;
                Rectangle rc;
                switch (typeOfCapture)
                {
                    case CaptureType.PrimaryScreen:
                        rc = Screen.PrimaryScreen.Bounds;
                        break;
                    case CaptureType.VirtualScreen:
                        rc = SystemInformation.VirtualScreen;
                        break;
                    case CaptureType.WorkingArea:
                        rc = Screen.PrimaryScreen.WorkingArea;
                        break;
                    case CaptureType.AllScreens:
                        count = screens.Length;
                        typeOfCapture = CaptureType.WorkingArea;
                        rc = screens[0].WorkingArea;
                        break;
                    default:
                        rc = SystemInformation.VirtualScreen;
                        break;
                }

                this.images = new Bitmap[count];

                for (int index = 0; index < count; index++)
                {
                    if (index > 0)
                        rc = screens[index].WorkingArea;

                    memoryImage = new Bitmap(rc.Width, rc.Height, PixelFormat.Format32bppArgb);

                    using (Graphics memoryGrahics = Graphics.FromImage(memoryImage))
                    {
                        memoryGrahics.CopyFromScreen(rc.X, rc.Y, 0, 0, rc.Size, CopyPixelOperation.SourceCopy);
                    }

                    this.images[index] = memoryImage;
                }
            }
            catch (Exception ex)
            {
                Log.Error("Screen capture failed.", ex);
            }

            return this.images;
        }
开发者ID:RSchwoerer,项目名称:Terminals,代码行数:54,代码来源:ScreenCapture.cs


示例17: Capture

 /// <summary>
 /// Capture the screen and save it into a file, which portion of the screen is captured
 /// is defined by <paramref name="typeOfCapture"/>.
 /// </summary>
 /// <param name="typeOfCapture">Selects, what is actually captured, see <see cref="CaptureType"/>.</param>
 /// <param name="filename">The name of the target file. The extension in there is ignored, 
 /// it will replaced by an extension derived from the desired file format.</param>
 /// <param name="format">The format of the file.</param>
 /// <returns>An array of images captured.</returns>
 public virtual Bitmap[] Capture( CaptureType typeOfCapture, String filename, ImageFormatHandler.ImageFormatTypes format )
 {
     Capture( typeOfCapture );
     Save( filename, format );
     return images;
 }
开发者ID:takkkken,项目名称:ssicat,代码行数:15,代码来源:ScreenCapture.cs


示例18: CreateCameraAndOpen

 /// <summary>
 /// Connect the current camera.
 /// </summary>
 /// <returns>Check for correct connection of the camera.</returns>
 public static bool CreateCameraAndOpen(CaptureType CaptureType, out CameraCapture NewCameraCapture)
 {
     NewCameraCapture = null;
     CameraCapture cameraCapture = CreateCamera(CaptureType);
     if (cameraCapture != null)
     {
         if (cameraCapture.Connect() == true)
         {
             if (cameraCapture.Open() == true)
             {
                 NewCameraCapture = cameraCapture;
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:VictorHelios,项目名称:OpenCVBestPractice,代码行数:21,代码来源:CameraHandler.cs


示例19: IsRegionCapture

 private bool IsRegionCapture(CaptureType captureType)
 {
     return captureType.HasFlagAny(CaptureType.RectangleWindow, CaptureType.Rectangle, CaptureType.RoundedRectangle, CaptureType.Ellipse,
         CaptureType.Triangle, CaptureType.Diamond, CaptureType.Polygon, CaptureType.Freehand, CaptureType.LastRegion);
 }
开发者ID:jakesyl,项目名称:ShareX,代码行数:5,代码来源:MainForm_Capture.cs


示例20: DoCaptureWork

        private void DoCaptureWork(ScreenCaptureDelegate capture, CaptureType captureType, TaskSettings taskSettings, bool autoHideForm = true)
        {
            if (autoHideForm)
            {
                Hide();
                Thread.Sleep(250);
            }

            Image img = null;

            try
            {
                Screenshot.CaptureCursor = taskSettings.CaptureSettings.ShowCursor;
                Screenshot.CaptureShadow = taskSettings.CaptureSettings.CaptureShadow;
                Screenshot.ShadowOffset = taskSettings.CaptureSettings.CaptureShadowOffset;
                Screenshot.CaptureClientArea = taskSettings.CaptureSettings.CaptureClientArea;
                Screenshot.AutoHideTaskbar = taskSettings.CaptureSettings.CaptureAutoHideTaskbar;

                img = capture();
            }
            catch (Exception ex)
            {
                DebugHelper.WriteException(ex);
            }
            finally
            {
                if (autoHideForm)
                {
                    this.ShowActivate();
                }

                AfterCapture(img, captureType, taskSettings);
            }
        }
开发者ID:jakesyl,项目名称:ShareX,代码行数:34,代码来源:MainForm_Capture.cs



注:本文中的CaptureType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Car类代码示例发布时间:2022-05-24
下一篇:
C# CaptureSqlFilter类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap