cropandlock.md
1 # Crop and Lock 2 3 [Public overview - Microsoft Learn](https://learn.microsoft.com/en-us/windows/powertoys/crop-and-lock) 4 5 ## Quick Links 6 7 [All Issues](https://github.com/microsoft/PowerToys/issues?q=is%3Aopen%20label%3AProduct-CropAndLock)<br> 8 [Bugs](https://github.com/microsoft/PowerToys/issues?q=is%3Aopen%20label%3AIssue-Bug%20label%3AProduct-CropAndLock)<br> 9 [Pull Requests](https://github.com/microsoft/PowerToys/pulls?q=is%3Apr+is%3Aopen+label%3AProduct-CropAndLock) 10 11 ## Overview 12 13 The Crop and Lock module in PowerToys allows users to crop a current application into a smaller window or create a thumbnail. This utility enhances productivity by enabling users to focus on specific parts of an application window. 14 15 ## Features 16 17 ### Thumbnail Mode 18 Creates a window showing the selected area of the original window. Changes in the original window are reflected in the thumbnail. 19 20 ### Reparent Mode 21 Creates a window that replaces the original window, showing only the selected area. The application is controlled through the cropped window. 22 23 ### Screenshot Mode 24 Creates a window showing a freezed snapshot of the original window. 25 26 ## Code Structure 27 28 ### Project Layout 29 The Crop and Lock module is part of the PowerToys solution. All the logic-related settings are in the main.cpp. The main implementations are in ThumbnailCropAndLockWindow and ReparentCropAndLockWindow. ChildWindow and OverlayWindow distinguish the two different modes of windows implementations. 30 31 ### Key Files 32 - **ThumbnailCropAndLockWindow.cpp**: Defines the UI for the thumbnail mode. 33 - **OverlayWindow.cpp**: Thumbnail module type's window concrete implementation. 34 - **ReparentCropAndLockWindow.cpp**: Defines the UI for the reparent mode. 35 - **ChildWindow.cpp**: Reparent module type's window concrete implementation. 36 - **ScreenshotCropAndLockWindow.cpp**: Defines the UI for the screenshot mode. 37 38 ## Known Issues 39 40 - Cropping maximized or full-screen windows in "Reparent" mode might not work properly. 41 - Some UWP apps may not respond well to being cropped in "Reparent" mode. 42 - Applications with sub-windows or tabs can have compatibility issues in "Reparent" mode. 43 44 ## Debug 45 1. build the entire project 46 2. launch the built Powertoys 47 3. select CropAndLock as the startup project in VS 48 4. In the debug button, choose "Attach to process".  49 5. Attach to CropAndLock.