Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
CodeDelphiRAD StudioWindows

How To Control Windows 11 Rounded Corners In Your App

How To Control Windows 11 Rounded Corners In Your App header image

As I hope you’re aware by now – RAD Studio 11 Alexandria is now available! The Windows IDE 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 here on the blog before, 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.

How To Control Windows 11 Rounded Corners In Your App notepad rounded corners
Source Microsoft

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 this article.

They also have an article, here, which describes how 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 that 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.

The question came up during the RAD Studio 11 launch Q & A whether the Embarcadero team had an example of using that API. Jim McKeeth 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 TNotificationCenter 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. 😋

How To Control Windows 11 Rounded Corners In Your App test Delphi 11 App
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.

How To Control Windows 11 Rounded Corners In Your App RAD Studio 11
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: https://github.com/checkdigits/rounded_corners

RAD Studio 11 Alexandria is available now! It’s a fantastic tool for creating all types of applications which can run natively on Windows, macOS, Linux, iOS and Android. Why not download a free trial and check it out today?

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

About author

Ian is the Embarcadero Developer Advocate, a professional writer, presenter, and host. He is a prolific software developer, voice actor, designer and poet. Ian is British American, born in London, now living in Dallas, Texas. "I get up early every day and write code".


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.