CaptureItPlus/Capturemodes/ActiveWindowCapture.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

namespace CaptureItPlus.Capturemodes
{
    using System;
    using System.Drawing;
    using System.Drawing.Imaging;
    using System.Windows.Forms;
    using System.Threading;
    using dotnetthoughts.CaptureItPlus;
    

    
    public class ActiveWindowCapture : ICaptureMode
    {
        private string _folder;
        private object _owner;
        private IntPtr _windowHandle = IntPtr.Zero;

        public string Name
        {
            get { return "ActiveWindow"; }
        }

        public string Text
        {
            get { return "&活动窗口"; }
        }

        //public Image Icon
        //{
        //    get { return Properties.Resources.activewin; }
        //}

        public string Description
        {
            get { return "Helps to capture Active Window from the running windows, if not Active window found, it will take desktop screenshot. It will capture the screen after 3 seconds."; }
        }

        public Keys ShortcutKey
        {
            get { return Keys.Control & Keys.F11; }
        }

        public void Initialize(params object[] arguments)
        {
            _folder = arguments[0].ToString();
            _owner = arguments[1].ToString();
        }

        public string Execute()
        {
            Thread.Sleep(3000);
            string fileName = string.Empty;
            var rect = default(NativeMethods.RECT);
            _windowHandle = NativeMethods.GetForegroundWindow();
            IntPtr handle = _windowHandle == IntPtr.Zero ? NativeMethods.GetDesktopWindow() : _windowHandle;
            if (NativeMethods.GetWindowRect(handle, ref rect))
            {
                var region = NativeMethods.ConvertToRectangle(rect);
                using (var bitmap = new Bitmap(region.Width, region.Height, PixelFormat.Format32bppArgb))
                {
后面还有 26 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。