The project from the first post above is using WinRT objects to render images in a PictureBox using GDI functions, hBitmaps and device contexts, thus bridging technologies several decades apart! Here's another spinoff of this project that replaces the PictureBox with a XAML Image Control for a completely modern approach. During this process, the included WinRT TypeLib has also grown from 150KB in the first post to 2.8MB in this post and now includes all XAML controls.

Here are some of the new features highlighted in this new project:

- The DrawFocusRect API function no longer works with the new Image Control and has been replaced with a customizable Rectangle control which results in a much smoother selection
- New mouse handling events grouped together under a single event procedure (no subclassing required):
- PointerPressed (VB6 equivalent: MouseDown)
- PointerMoved (VB6 equivalent: MouseMove), used here to resize the Selection Rectangle for cropping the image
- PointerReleased (VB6 equivalent: MouseUp)
- PointerWheelChanged (No native VB6 equivalent, closest match would be subclassing WM_MOUSEWHEEL)
- The Mouse Wheel is used here for a very smooth Zoom In/Out effect by applying a Scale Transform in real time

The rest of the functionality remains the same, you can decode from various picture formats, apply some transforms and save the result as another picture format from the supported formats list.

The project also works in the IDE and for that purpose the ZIP archive contains the VB6.EXE.manifest file which you need to apply to the main VB6.EXE executable using either the manifest tool (MT.EXE from the Windows SDK) or Resource Hacker, whichever you prefer (both are free). Alternatively you can just compile the executable and test that instead if you don't want to edit VB6.EXE.

Here is the demo project: BitmapEncoderXAMLIslands.zip

Requirements: Windows 10 or later!