You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: hub/apps/desktop/modernize/apply-rounded-corners.md
+6-8Lines changed: 6 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
description: Apply rounded corners in your desktop application.
3
3
title: Apply rounded corners in desktop apps
4
4
ms.topic: article
5
-
ms.date: 01/28/2022
5
+
ms.date: 04/25/2023
6
6
ms.author: jimwalk
7
7
author: jwmsft
8
8
ms.localizationpriority: medium
@@ -15,7 +15,7 @@ Rounded corners are the most immediately noticeable feature of [Windows 11 Geome
15
15
> [!NOTE]
16
16
> By design, apps are not rounded when maximized, snapped, running in a Virtual Machine (VM), running on a Windows Virtual Desktop (WVD), or running as a Windows Defender Application Guard (WDAG) window.
17
17
18
-
:::image type="content" source="./images/apply-design/notepad-rounded.png" alt-text="The Notepad app on Windows 11 with rounded corners.":::
18
+
:::image type="content" source="./images/apply-design/notepad-rounded.png" alt-text="A screenshot of the Notepad app on Windows 11 with rounded corners.":::
19
19
20
20
## Why isn't my app rounded?
21
21
@@ -44,9 +44,7 @@ If your app's main window doesn't receive automatic rounding, it's because you'v
44
44
45
45
## How to opt in to rounded corners
46
46
47
-
### API definition
48
-
49
-
If your app is not rounded by policy, you can optionally call our new API to allow your app to opt in to rounded corners. This API is expressed as enumeration values to be passed to the [**DwmSetWindowAttribute**](/windows/win32/api/dwmapi/nf-dwmapi-dwmsetwindowattribute) API, as shown in the new **DWM_WINDOW_CORNER_PREFERENCE** enumeration. **DWM_WINDOW_CORNER_PREFERENCE** is defined in the [dwmapi.h header](/windows/win32/api/dwmapi/) and is available in the latest [Insider Preview SDK](https://www.microsoft.com/software-download/windowsinsiderpreviewSDK).
47
+
If your app is not rounded by policy, you can optionally use these APIs to let your app opt-in to rounded corners. You specify the corner rounding option you want for your app by passing a value of the [**DWM_WINDOW_CORNER_PREFERENCE**](/windows/win32/api/dwmapi/ne-dwmapi-dwm_window_corner_preference) enumeration (shown in the following table) to the [**DwmSetWindowAttribute**](/windows/win32/api/dwmapi/nf-dwmapi-dwmsetwindowattribute) function.
50
48
51
49
| Enum value | Description |
52
50
| --- | --- |
@@ -55,17 +53,17 @@ If your app is not rounded by policy, you can optionally call our new API to all
55
53
|**DWMWCP_ROUND**| Round the corners if appropriate. |
56
54
|**DWMWCP_ROUNDSMALL**| Round the corners if appropriate, with a small radius. |
57
55
58
-
A pointer to the appropriate value from this enum is passed to the third parameter of DwmSetWindowAttribute. For the second parameter, which specifies which attribute you are setting, pass the new**DWMWA_WINDOW_CORNER_PREFERENCE** value defined in the [**DWMWINDOWATTRIBUTE**](/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute) enumeration.
56
+
A pointer to the appropriate value from this enum is passed to the third parameter of **DwmSetWindowAttribute**. For the second parameter, which specifies which attribute you are setting, pass the **DWMWA_WINDOW_CORNER_PREFERENCE** value defined in the [**DWMWINDOWATTRIBUTE**](/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute) enumeration.
59
57
60
58
### For C# apps
61
59
62
-
DwmSetWindowAttribute is a native Win32 API and is not exposed directly to .NET code. You'll need to use your language's implementation of P/Invoke to declare the function (C# code is given in the example below). All standard WinForms and WPF apps are rounded automatically, but if you customize your window frame or use a third party framework, you might need to opt-in to rounded corners. See the Examples section for further details.
60
+
[**DwmSetWindowAttribute**](/windows/win32/api/dwmapi/nf-dwmapi-dwmsetwindowattribute) is a native Win32 API and is not exposed directly to .NET code. You'll need to use your language's implementation of [P/Invoke](/dotnet/standard/native-interop/pinvoke) to declare the function (C# code is given in the example below). All standard WinForms and WPF apps are rounded automatically, but if you customize your window frame or use a third party framework, you might need to opt-in to rounded corners. See the Examples section for further details.
63
61
64
62
## Examples
65
63
66
64
The following examples show how you can call [**DwmSetWindowAttribute**](/windows/win32/api/dwmapi/nf-dwmapi-dwmsetwindowattribute) or [**DwmGetWindowAttribute**](/windows/win32/api/dwmapi/nf-dwmapi-dwmgetwindowattribute) to control your app's rounding experience if your app is not rounded by policy.
67
65
68
-
> [!Note]
66
+
> [!NOTE]
69
67
> Error handling has been left out of these examples for brevity and clarity.
70
68
71
69
### Example 1 - Rounding an app's main window in C# - WPF
0 commit comments