setWindowRoundedCorners method
Sets this Window rounded corners attributes.
- If
roundedistruewill set this Window with rounded corners, otherwise will disable the rounded corners. - If
smallistrueround the corners with a small radius.
Implementation
void setWindowRoundedCorners({bool rounded = true, bool small = false}) {
final pref = calloc<DWORD>();
try {
final hwnd = this.hwnd;
pref.value = rounded
? (small ? DWMWCP_ROUNDSMALL : DWMWCP_ROUND)
: DWMWCP_DONOTROUND;
DwmSetWindowAttribute(
hwnd,
DWMWA_WINDOW_CORNER_PREFERENCE,
pref,
sizeOf<DWORD>(),
);
} on WindowsException catch (e) {
// Not supported before Windows 11:
_logWindow.warning("Can't set window rounded corners: $e");
} finally {
free(pref);
}
}