How To Control Windows 11 Rounded Corners In Your App
By Ian Barker September 10, 2021
![1631603816884.png 1631603816884.png](https://dumpz.ws/data/attachments/6/6106-c1cdaddce45a7471518644654d414339.jpg)
As I hope you’re aware by now – Для просмотра ссылки Войдиили Зарегистрируйся is now available! RAD Studio 11 contains a whole ton of features and it’s launching just ahead of Microsoft’s official release of the beautifully redesigned Windows 11. We wrote about the many great things contained in Windows 11 Для просмотра ссылки Войди или Зарегистрируйся and how behind that gorgeously aesthetic user interface are a few traps and pitfalls which may be a problem for older legacy apps and hardware.
![1631603831159.png 1631603831159.png](https://dumpz.ws/data/attachments/6/6107-4db0612a681644acc7f4b19c4a5d30ad.jpg)
One of the most obvious user interface changes is the fact that almost all app windows and many user interface controls will get a rounded corner effect applied to them. The amount of rounding of the application’s forms and things like text boxes, panels and group boxes will vary. Microsoft go into a lot more detail on how it will affect user interface components here in Для просмотра ссылки Войдиили Зарегистрируйся.
They also have an article, Для просмотра ссылки Войдиили Зарегистрируйся, which describes how the rounding of the application forms occurs and also how to turn that rounding feature on or off. Microsoft recognizes that some app windows are not going to work very well with rounding applied to the caption bar – for example tool window type application frames which typically have a very narrow height and custom-drawn window icons.
Thinking ahead, Windows 11 provides a fairly easy to use Windows API which allows you full control over that rounding behavior – to turn it off, on, or ask Windows 11 to round the windows with a smaller radius.
![1631603858272.png 1631603858272.png](https://dumpz.ws/data/attachments/6/6108-958540439d01e7ce1a4bc7c50fda647c.jpg)
![1631603879602.png 1631603879602.png](https://dumpz.ws/data/attachments/6/6109-10be83527a829f18d35c03eea4a18bfa.jpg)
The question came up during the RAD Studio 11 launch Q & A whether the Embarcadero team had an example of using that API. David (or Marco, it wasn’t clear) pasted a short example of how to do it in the question window but it was a little hard to read and only a partial example so I’ve taken that answer and built a more complete demo for you to download and play with. Just for fun it also shows Windows notifications using the Для просмотра ссылки Войдиили Зарегистрируйсяcomponent because if we’re going to be modern we might as well embrace a few of the other cool modern Windows things Delphi makes very easy.
![1631603906471.png 1631603906471.png](https://dumpz.ws/data/attachments/6/6110-e78c53e13b3d1784a5a5f8a23e67cc35.jpg)
RAD Studio 11 Delphi example rounded corners app running on Windows 11
On versions of Windows before Windows 11 the API call will have no effect and your app Windows will still look the same. On Windows 11 the example app controls the main form Window based on your choices from a radio group. I’ve created a universal unit with a simple call in there – all you need to do is pass it a Window handle and Windows 11 will do your bidding.
![1631603936706.png 1631603936706.png](https://dumpz.ws/data/attachments/6/6111-3ce6d06b6f28a4459caac022775adcae.jpg)
RAD Studio 11 is High DPI aware – so my screenshots look better now too!
The example app is written in the new RAD Studio 11 Alexandria, of course, but it should work on earlier versions of Delphi. To use the code in your own apps simply download the source repository from the GitHub link below and include the “delphi_rounded_corners.pas” unit in your apps and make the procedure call.
You can download the full source for the example RAD Studio 11 Delphi example application from here: Для просмотра ссылки Войдиили Зарегистрируйся
By Ian Barker September 10, 2021
![1631603816884.png 1631603816884.png](https://dumpz.ws/data/attachments/6/6106-c1cdaddce45a7471518644654d414339.jpg)
As I hope you’re aware by now – Для просмотра ссылки Войди
![1631603831159.png 1631603831159.png](https://dumpz.ws/data/attachments/6/6107-4db0612a681644acc7f4b19c4a5d30ad.jpg)
One of the most obvious user interface changes is the fact that almost all app windows and many user interface controls will get a rounded corner effect applied to them. The amount of rounding of the application’s forms and things like text boxes, panels and group boxes will vary. Microsoft go into a lot more detail on how it will affect user interface components here in Для просмотра ссылки Войди
They also have an article, Для просмотра ссылки Войди
Thinking ahead, Windows 11 provides a fairly easy to use Windows API which allows you full control over that rounding behavior – to turn it off, on, or ask Windows 11 to round the windows with a smaller radius.
![1631603858272.png 1631603858272.png](https://dumpz.ws/data/attachments/6/6108-958540439d01e7ce1a4bc7c50fda647c.jpg)
![1631603879602.png 1631603879602.png](https://dumpz.ws/data/attachments/6/6109-10be83527a829f18d35c03eea4a18bfa.jpg)
The question came up during the RAD Studio 11 launch Q & A whether the Embarcadero team had an example of using that API. David (or Marco, it wasn’t clear) pasted a short example of how to do it in the question window but it was a little hard to read and only a partial example so I’ve taken that answer and built a more complete demo for you to download and play with. Just for fun it also shows Windows notifications using the Для просмотра ссылки Войди
![1631603906471.png 1631603906471.png](https://dumpz.ws/data/attachments/6/6110-e78c53e13b3d1784a5a5f8a23e67cc35.jpg)
RAD Studio 11 Delphi example rounded corners app running on Windows 11
On versions of Windows before Windows 11 the API call will have no effect and your app Windows will still look the same. On Windows 11 the example app controls the main form Window based on your choices from a radio group. I’ve created a universal unit with a simple call in there – all you need to do is pass it a Window handle and Windows 11 will do your bidding.
![1631603936706.png 1631603936706.png](https://dumpz.ws/data/attachments/6/6111-3ce6d06b6f28a4459caac022775adcae.jpg)
RAD Studio 11 is High DPI aware – so my screenshots look better now too!
The example app is written in the new RAD Studio 11 Alexandria, of course, but it should work on earlier versions of Delphi. To use the code in your own apps simply download the source repository from the GitHub link below and include the “delphi_rounded_corners.pas” unit in your apps and make the procedure call.
You can download the full source for the example RAD Studio 11 Delphi example application from here: Для просмотра ссылки Войди