When starting the program, sometimes the window was displayed incorrectly.
Reworked the architecture.