Correct StringFormat initialization in test code
This PR fixes a memory leak in the DrawIndex function where a Gdiplus::StringFormat object was allocated on the heap using new but never released. Each call to DrawIndex leaked one StringFormat instance, which could accumulate over time and degrade performance.
Changes Replaced heap allocation (new Gdiplus::StringFormat()) with stack allocation (Gdiplus::StringFormat stringFormat;).
Ensured StringFormat is properly destroyed when DrawIndex returns, eliminating the leak.
No functional changes to rendering behavior text alignment and line alignment remain identical.
Impact Bug fix: Prevents memory leaks during repeated calls to DrawIndex.
Performance improvement: Reduces unnecessary memory consumption in scenarios where indexes are drawn frequently.
Code quality: Aligns with RAII best practices in C++ by avoiding manual memory management.
Testing Verified that text rendering output remains unchanged.
Confirmed via runtime checks that no additional allocations persist after DrawIndex completes.
Is there an issue for this? Was there any discussion or agreement for this change?
This seems to be a proof-of-concept tool to test the zone rendering of Fancy Zones. It is not compiled as part of the released version of PowerToys, and any potential GDI+ object leaks would be cleared up on exiting the application.