fix(layout): clip main body to rounded bottom corners

This commit is contained in:
Meik
2026-03-05 16:40:26 +01:00
parent abd179a7e6
commit a6358d581e
3 changed files with 45 additions and 10 deletions

View File

@@ -2191,9 +2191,39 @@ namespace C4IT_CustomerPanel
MainWindowSurface.Clip = new RectangleGeometry(new Rect(0d, 0d, surfaceWidth, surfaceHeight), surfaceRadius, surfaceRadius);
MainWindowContentRoot.Clip = new RectangleGeometry(new Rect(0d, 0d, contentWidth, contentHeight), contentRadius, contentRadius);
if (btnSP != null && btnSP.ActualWidth > 0d && btnSP.ActualHeight > 0d)
{
btnSP.Clip = CreateBottomRoundedRectGeometry(btnSP.ActualWidth, btnSP.ActualHeight, surfaceRadius);
}
_mainSurfaceClipInitialized = true;
}
private static Geometry CreateBottomRoundedRectGeometry(double width, double height, double radius)
{
if (width <= 0d || height <= 0d)
return Geometry.Empty;
double r = Math.Max(0d, Math.Min(radius, Math.Min(width / 2d, height / 2d)));
if (r <= 0d)
return new RectangleGeometry(new Rect(0d, 0d, width, height));
var geometry = new StreamGeometry();
using (var context = geometry.Open())
{
context.BeginFigure(new Point(0d, 0d), true, true);
context.LineTo(new Point(width, 0d), true, false);
context.LineTo(new Point(width, height - r), true, false);
context.ArcTo(new Point(width - r, height), new Size(r, r), 0d, false, SweepDirection.Clockwise, true, false);
context.LineTo(new Point(r, height), true, false);
context.ArcTo(new Point(0d, height - r), new Size(r, r), 0d, false, SweepDirection.Clockwise, true, false);
context.LineTo(new Point(0d, 0d), true, false);
}
geometry.Freeze();
return geometry;
}
}
public class cMainFunctionInfo