PS放大和缩小方法

1、选中放大镜

a、鼠标点击相应的放大或者缩小

b、按住Alt往外和内移动鼠标也可以放大和缩小

2、不需要选中放大镜,用键盘

command+空格+(+ 或者 -)

3、不需要选中放大镜,用键盘和鼠标

Alt+空格+鼠标

放大后需要看图片的局部位置,移动看,注意:缩小不可以

空格+移动鼠标

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是使用GDI绘制抛物线和双曲线的示例代码,包括放大缩小和移动功能: ```c++ #include <windows.h> #include <cmath> LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) { static TCHAR szAppName[] = TEXT("Parabola and Hyperbola"); HWND hwnd; MSG msg; WNDCLASS wndclass; wndclass.style = CS_HREDRAW | CS_VREDRAW; wndclass.lpfnWndProc = WndProc; wndclass.cbClsExtra = 0; wndclass.cbWndExtra = 0; wndclass.hInstance = hInstance; wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION); wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); wndclass.lpszMenuName = NULL; wndclass.lpszClassName = szAppName; if (!RegisterClass(&wndclass)) { MessageBox(NULL, TEXT("This program requires Windows NT!"), szAppName, MB_ICONERROR); return 0; } hwnd = CreateWindow(szAppName, TEXT("Parabola and Hyperbola"), WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL); ShowWindow(hwnd, iCmdShow); UpdateWindow(hwnd); while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return msg.wParam; } LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { static int cxClient, cyClient; static int xCenter, yCenter; static double scaleX = 1.0, scaleY = 1.0; static double xMove = 0.0, yMove = 0.0; static POINT ptPrev; static bool bDragging = false; switch (message) { case WM_SIZE: cxClient = LOWORD(lParam); cyClient = HIWORD(lParam); xCenter = cxClient / 2; yCenter = cyClient / 2; return 0; case WM_KEYDOWN: switch (wParam) { case VK_ADD: scaleX *= 1.1; scaleY *= 1.1; InvalidateRect(hwnd, NULL, TRUE); return 0; case VK_SUBTRACT: scaleX /= 1.1; scaleY /= 1.1; InvalidateRect(hwnd, NULL, TRUE); return 0; case VK_LEFT: xMove -= 10.0 / scaleX; InvalidateRect(hwnd, NULL, TRUE); return 0; case VK_RIGHT: xMove += 10.0 / scaleX; InvalidateRect(hwnd, NULL, TRUE); return 0; case VK_UP: yMove -= 10.0 / scaleY; InvalidateRect(hwnd, NULL, TRUE); return 0; case VK_DOWN: yMove += 10.0 / scaleY; InvalidateRect(hwnd, NULL, TRUE); return 0; } return 0; case WM_LBUTTONDOWN: SetCapture(hwnd); ptPrev.x = LOWORD(lParam); ptPrev.y = HIWORD(lParam); bDragging = true; return 0; case WM_MOUSEMOVE: if (bDragging) { xMove += (LOWORD(lParam) - ptPrev.x) / scaleX; yMove += (HIWORD(lParam) - ptPrev.y) / scaleY; InvalidateRect(hwnd, NULL, TRUE); ptPrev.x = LOWORD(lParam); ptPrev.y = HIWORD(lParam); } return 0; case WM_LBUTTONUP: ReleaseCapture(); bDragging = false; return 0; case WM_PAINT: { PAINTSTRUCT ps; HDC hdc = BeginPaint(hwnd, &ps); // set up coordinate transformation SetMapMode(hdc, MM_ANISOTROPIC); SetViewportOrgEx(hdc, xCenter, yCenter, NULL); SetWindowExtEx(hdc, cxClient, -cyClient, NULL); SetViewportExtEx(hdc, (int)(cxClient / scaleX), (int)(cyClient / scaleY), NULL); SetWindowOrgEx(hdc, (int)(-xMove * scaleX), (int)(yMove * scaleY), NULL); // draw parabola MoveToEx(hdc, -1000, (int)(1000 * 1000), NULL); for (int x = -1000; x <= 1000; x++) { int y = (int)(-x * x / 1000.0); LineTo(hdc, x, y); } // draw hyperbola MoveToEx(hdc, -1000, 0, NULL); for (int x = -1000; x <= -1; x++) { int y = (int)(1000 * sqrt(1.0 + x * x / 1000.0)); LineTo(hdc, x, y); } for (int x = 1; x <= 1000; x++) { int y = (int)(-1000 * sqrt(1.0 + x * x / 1000.0)); LineTo(hdc, x, y); } EndPaint(hwnd, &ps); return 0; } case WM_DESTROY: PostQuitMessage(0); return 0; } return DefWindowProc(hwnd, message, wParam, lParam); } ``` 在上述代码中,我们使用 `SetMapMode` 和 `SetViewportOrgEx` 等 GDI 函数设置了坐标系的变换,使得我们可以方便地实现放大缩小和移动功能。抛物线和双曲线的绘制都是通过 `LineTo` 函数实现的,具体细节可以参考代码注释。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值