如何仅使用屏幕的一部分,就好像显示器较小一样?

如何仅使用屏幕的一部分,就好像显示器较小一样?

水溅到我的 19 英寸显示器上,损坏了它的某些部件。我需要一个解决方案,让我可以指定 Windows 要使用的屏幕区域,就像它是一台较小的显示器一样。它的默认菜单没有此选项。

答案1

Winsplit-革命可能会满足您的需要。

答案2

您的显示器是什么型号?它可能在设置中具有“1:1 像素模式”或类似功能。设置该选项后,您可以在计算机上指定较低的屏幕分辨率,显示器将仅使用该像素数,而不是将图像缩放到全屏。

答案3

这个简单的 C 程序可以完成这个任务。

它设置了所谓的“工作区”矩形,Win OS 使用该矩形来限制最大化和对齐的窗口。

您也可以选择限制鼠标外出。

它还尝试检索错误代码的操作系统描述,以便更好地排除意外和未曾听说过的问题!

我尝试将其放在一个文件中以方便保存和使用:

#define APP_TITLE L"Set_Work_Area"
#define USAGE   L"Usage:  Set_Work_Area  [ Work Area [ Cursor Clipping ] ]\nEach is a rectangle specified as:    Left  Top  Right  Bottom\nThe right and bottom are exclusive (that is, one pixel out. MS's design).\n\nExample: Set_Work_Area 245 40 1366 568\nSets Work Area for a 1366x768 monitor with 245 unusable columns in the left and\n200 unusable rows in the bottom, which has a 40 rows Taskbar in the top.\n\nExample: Set_Work_Area 245 40 1366 568 245 0 1366 568\nFor the above example, also limits the mouse to the Work Area and the Taskbar.\n\nNote: Both are reset by Win OS in lock-screen(and in full-screen Start Menu for\nCursor Clipping). Putting in Start Menu and Scheduled Tasks seems good.\n\nFor multi-monitor systems, this is relative to the whole desktop, and is only\nset for the monitor that contains the specified rectangle.\n\nWork Area is a rectangle used by Win OS to horizontally/vertically bound\napp windows when they'r maximized, vertically-expanded (like by double-clicking\nthe horizontal edge), or left/right-aligned (by Win+Left/Win+Right hotkeys).\nCursor Clipping is a procedure used by Win OS to restrict the mouse cursor."

#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <shellapi.h>
#include <stdint.h>
#include <stdio.h>

int error(WCHAR *context);

int WINAPI WinMain(HINSTANCE in_hInstance, HINSTANCE hPrevInstance, LPSTR CmdLine, int CmdShow)
{
    int argc;
    WCHAR **argv = CommandLineToArgvW(GetCommandLineW(), &argc);
    if (argc != 4 && argc != 8)
        return error(L"Incorrect number of arguments.");
    LONG c[4];
    for (int i = 0; i < 4; i++)
        c[i] = wcstol(argv[i], (WCHAR **)NULL, 10);
    if (c[2] < c[0] + 200 || c[3] < c[1] + 200)
        return error(L"The specified Work Area has less than 200 pixels in width or height.");
    if (!SystemParametersInfoW(SPI_SETWORKAREA, 0, c, SPIF_SENDCHANGE))
        return error(L"SPI_SETWORKAREA error.");
    if (argc == 8)
    {
        RECT *r = (RECT *)c;
        for (int i = 0; i < 4; i++)
            c[i] = wcstol(argv[i + 4], (WCHAR **)NULL, 10);
        if (!ClipCursor(r))
            return error(L"ClipCursor error.");
    }
    return 0;
}

int error(WCHAR *context)
{
    uint32_t last_error = GetLastError();
    WCHAR desc[0x21000] = {0};
    WCHAR out[0x22000];
    if (last_error)
        if (!FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, last_error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (WCHAR *)&(desc), 0, NULL))
            snwprintf(desc, 0x21000, L"Could not retrieve error description; Error number=%d", last_error);
    snwprintf(out, 0x22000, L"Error: %s%s%s\n\n%s", context ? context : L"",
    desc[0] ? L"\nMore description: " : L"", desc, USAGE);
    if (desc[0])
        LocalFree(desc);
    MessageBoxW(NULL, out, APP_TITLE, MB_OK);
    return 1;
}

如何使用:

  1. 另存为Set_Work_Area.C并使用以下方式编译:
    gcc -mwindows -x c -std=c99 Set_Work_Area.C -o Set_Work_Area.exe
  2. 找到所需的工作区。您可以通过调整窗口大小以适合屏幕的所需部分并执行 PrintScreen 来实现此目的(如果使用鼠标调整窗口大小时遇到​​困难,您可以使用Alt+ Space,然后S调整大小,然后使用一个箭头键选择相应的窗口边缘,然后使用箭头键移动该边缘,然后Enter进行设置)。
  3. 粘贴到图像编辑器中并获取窗口的左、上、右和底部尺寸。
  4. 运行。当不带参数运行程序时,将以文本形式Set_Work_Area.exe left right top bottom提供完整描述。USAGE
  5. 打开任何程序,按Win+Up最大化,(或按Win+LeftWin+Right对齐)然后享受。

如果您设置了不需要的工作区域矩形,请按Win+将锁屏L重置。


文本的副本USAGE,以防有人不方便查看消息框:

用法:Set_Work_Area [ Work Area [ Cursor Clipping ] ]
每个都是一个矩形,指定为: Left Top Right Bottom
右侧和底部是互斥的(即,一个像素外。MS 的设计)。

示例:为左侧有不可用列、 底部有不可用行的显示器Set_Work_Area 245 40 1366 568
设置工作区,顶部有行任务栏。示例:对于上述示例,还将鼠标限制在工作区和任务栏上。注意:Win OS 在锁定屏幕(以及全屏开始菜单中的光标剪辑)中重置了两者。开始菜单快捷方式(可能还有计划任务)很方便。对于多显示器系统,这是相对于整个桌面的,并且仅为包含指定矩形的显示器设置。工作区是 Win OS 用来在应用程序窗口最大化、垂直扩展(例如双击水平边缘)或左/右对齐(使用 + / +热键)时水平/垂直绑定应用程序窗口的矩形。光标剪辑是 Win OS 用于限制鼠标光标的程序。1366x76824520040

Set_Work_Area 245 40 1366 568 245 0 1366 568






WinLeftWinRight

相关内容