小编Rev*_*ror的帖子

如何在没有表单的情况下捕获屏幕?

这是一个我用来捕捉我的屏幕和鼠标cursour作为截图的类.但我想以某种方式表明,如果表单位于屏幕中间,则不会捕获屏幕和表单后面的区域,而不是表单自身.

即使表单在前面,我点击按钮或在应用程序运行时更改窗体中的内容不要捕获它只是继续捕获屏幕表格后面的区域,如表格不存在.

using System;
using System.Runtime.InteropServices;
using System.Drawing;
using System.Drawing.Imaging;
using System.Windows.Forms;

namespace ScreenShotDemo
{
    public class ScreenCapture
    {
        [StructLayout(LayoutKind.Sequential)]
        struct CURSORINFO
        {
            public Int32 cbSize;
            public Int32 flags;
            public IntPtr hCursor;
            public POINTAPI ptScreenPos;
        }

        [StructLayout(LayoutKind.Sequential)]
        struct POINTAPI
        {
            public int x;
            public int y;
        }

        [DllImport("user32.dll")]
        static extern bool GetCursorInfo(out CURSORINFO pci);

        [DllImport("user32.dll")]
        static extern bool DrawIcon(IntPtr hDC, int X, int Y, IntPtr hIcon);

        const Int32 CURSOR_SHOWING = 0x00000001;

        public static Bitmap CaptureScreen(bool CaptureMouse)
        {
            Bitmap result = …
Run Code Online (Sandbox Code Playgroud)

c# winforms

2
推荐指数
1
解决办法
1144
查看次数

为什么按Ctrl + M不起作用?

我希望我的应用程序响应Ctrl+ M它会做一些事情:

if (e.KeyCode == System.Windows.Forms.Keys.M 
    && e.KeyCode == System.Windows.Forms.Keys.RControlKey)
Run Code Online (Sandbox Code Playgroud)

我试图点击Ctrl+ M(我尝试了左右Ctrl键)并且它在断点处停止if但从未进入.为什么不呢?

c# winforms

0
推荐指数
1
解决办法
155
查看次数

标签 统计

c# ×2

winforms ×2