setWindowRoundedCorners method

void setWindowRoundedCorners({
  1. bool rounded = true,
  2. bool small = false,
})

Sets this Window rounded corners attributes.

  • If rounded is true will set this Window with rounded corners, otherwise will disable the rounded corners.
  • If small is true round 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
            ? DWM_WINDOW_CORNER_PREFERENCE.DWMWCP_ROUNDSMALL
            : DWM_WINDOW_CORNER_PREFERENCE.DWMWCP_ROUND)
        : DWM_WINDOW_CORNER_PREFERENCE.DWMWCP_DONOTROUND;

    DwmSetWindowAttribute(
      hwnd,
      DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE,
      pref,
      sizeOf<DWORD>(),
    );
  } finally {
    free(pref);
  }
}