public void SetBorderCurve(int radius) { Region r = Region; if (r != null) { r.Dispose(); } IntPtr toBeDestroyed = CreateRoundRectRgn(0, 0, Width, Height, radius, radius); Region = Region.FromHrgn(toBeDestroyed); MainLauncher.DeleteObject(toBeDestroyed); }
public static void SetBorderCurve(int radius, Control ctrl) { Region r = ctrl.Region; if (r != null) { r.Dispose(); } IntPtr toBeDestroyed = CreateRoundRectRgn(0, 0, ctrl.Width, ctrl.Height, radius, radius); r = Region.FromHrgn(toBeDestroyed); ctrl.Region = r; MainLauncher.DeleteObject(toBeDestroyed); return; }