AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

More VCL Support for Windows 11

Ein Thema von DP News-Robot · begonnen am 15. Okt 2021
Antwort Antwort
Benutzerbild von DP News-Robot
DP News-Robot

Registriert seit: 4. Jun 2010
15.473 Beiträge
 
#1

More VCL Support for Windows 11

  Alt 15. Okt 2021, 12:50
After the announcement earlier this year, Microsoft has now officially released Windows 11 last week. Despite some issues running the new operating system on older computers due to new hardware requirements, the new version of Windows offers a nicer user experience and working environment, while maintaining a very high degree of compatibility with existing applications, including those written with Delphi and C++Builder. We are expecting a lot of end users will move to Windows 11 in the coming months.

In this blog post, I don't want to focus on Windows 11 and its renewed user experience, but rather on how you can further improve your VCL applications to make them first class citizen in the new OS. In general terms, there are many modernization techniques Delphi and C++Builder offer to better fit with recent versions of Windows, from the use of VCL styles to the adoption to the*many new VCL controls introduced over recent years (up to the ControlList and*the NumberBox controls in RAD Studio 10.4.2*and the revamped RichEdit in RAD Studio 11 Alexandria).

Let's focus on Windows 11 specific support, going even further than general migration suggestions and ideas. Windows 11 ships with the WebView2 controls, so this is a great time for adopting TEdgeBrowser over the TWebBrowser component. Also, Microsoft keeps focusing on packaged apps and the Microsoft Store, two capabilities you can achieve via RAD Studio IDE support for the MSIX deployment format. These features are in the current version of RAD Studio 11 (and were there even earlier).

New Windows 11 VCL Styles

What we have released yesterday and is now available in GetIt is a set of two new VCL styles specific to Windows 11, for light and dark mode. Type "Windows 11" in the search bar to locate them quickly:



Once you have installed the two styles, you can open a VCL project settings, go the Appearance page, add the styles to the application and (if you have enabled the use of VCL styles at design time), pick*them in the StyleName property of a form to preview them at design time, like in the image below. Notice, among other elements, the modern style thin scrollbars in the list box.



We do have some more "official" images of the two styles below, where you can see additional rounded element and colors matching the new platform defaults.





Windows 11 Rounded Corners

One of the most visible elements of Windows 11 is the use of "rounded UI elements", starting with the rounded form corners. If you create a brand new VCL application with no special configuration or setting and run it on Windows 11, you should see rounder corners for forms by default. However, this is a feature you have full control onto using a specific, public Windows API call DwmSetWindowAttribute:

Winapi.Dwmapi.DwmSetWindowAttribute(Handle, DWMWA_WINDOW_CORNER_PREFERENCE, @CornerPreference, sizeof(CornerPreference)); To make it easier to use this API (already covered by Ian Barker in a detailed blog post titled "How To Control Windows 11 Rounded Corners In Your App"), I wrote*an interposer helper class with similar code, available on*GitHub at:

https://github.com/marcocantu/Delphi...Win11Forms.pas

You can see the interface section of the unit here:



Just add this unit in the uses statement of the interface section of a form, after the Vcl.Forms unit, and your form will have a new class property indicating the default rounding and a new property for the specific form setting, so you can write:

TForm.DefaultRoundedCorners := rcOff; // set default for all forms RoundedCorners := rcOn; // change the rounding for the current form This code works only on Windows 11, as Windows 10 or previous versions ignore it (but don't raise any error). I used it in a simple demo (also at GitHub*at*https://github.com/marcocantu/Delphi...i11/Win11Round) with the following UI:



Finally notice that VCL applications, including those that use the custom VCL*TitleBar offer support for Snap Layouts out of the box:



One Small Issue and More to Come

As I mentioned earlier, VCL applications generally work fine on Windows 11. There is one issue with the coloring of menu items with associated images, given the platform uses a different set of default colors a VCL application doesn't fully respect. This has been reported at QP https://quality.embarcadero.com/browse/RSP-35049. While there is a workaround in the Quality Portal report, we are planning to offer a fix for RAD Studio 11 for this issue shortly.

We are planning some further Windows 11 related improvements and demos of new features in the coming months and in the future RAD Studio 11.1 release. Stay tuned.

Build Applications for Windows 11 with VCL

It is not a mystery that Embarcadero used version 11 for the last release of RAD Studio to tie it with Windows 11. With all of the changes in UI libraries that Microsoft own tools underwent in recent years, I am certain that the broadness of API support and platform integration offered by the VCL library in Delphi and C++Builder is unparalleled by Microsoft Visual Studio or any third party set of tools. Microsoft has been clearly indicating native*Windows development is and remains key (see Windows App SDK, aka Project Reunion) and remains the mainstream option, but their libraries in this space (like MFC and WinForms) are not on par with VCL and lag behind their own platform features.

The VCL library, with its ability to map to classic and modern APIs (from Win API, to COM-based APIs, to WinRT) and its support for High DPI*monitors and modern UI trends -- all without requiring a full application rewrite -- is unique in the Windows desktop development scenario and clearly stands out for its power. For Windows 11 development, the Visual Component Library is the way to go.



Weiterlesen...
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 01:41 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz