public Rectangle DrawEdge(IDeviceContext dc, Rectangle bounds, Edges edges, EdgeStyle style, EdgeEffects effects) { if (dc == null) { throw new ArgumentNullException(nameof(dc)); } if (!ClientUtils.IsEnumValid_Masked(edges, (int)edges, (uint)(Edges.Left | Edges.Top | Edges.Right | Edges.Bottom | Edges.Diagonal))) { throw new InvalidEnumArgumentException(nameof(edges), (int)edges, typeof(Edges)); } if (!ClientUtils.IsEnumValid_NotSequential(style, (int)style, (int)EdgeStyle.Raised, (int)EdgeStyle.Sunken, (int)EdgeStyle.Etched, (int)EdgeStyle.Bump)) { throw new InvalidEnumArgumentException(nameof(style), (int)style, typeof(EdgeStyle)); } if (!ClientUtils.IsEnumValid_Masked(effects, (int)effects, (uint)(EdgeEffects.FillInterior | EdgeEffects.Flat | EdgeEffects.Soft | EdgeEffects.Mono))) { throw new InvalidEnumArgumentException(nameof(effects), (int)effects, typeof(EdgeEffects)); } using var wgr = new WindowsGraphicsWrapper(dc, AllGraphicsProperties); var hdc = new HandleRef(wgr, wgr.WindowsGraphics.DeviceContext.Hdc); RECT destRect = bounds; var contentRect = new RECT(); lastHResult = UxTheme.DrawThemeEdge(this, hdc, part, state, ref destRect, (User32.EDGE)style, (User32.BF)edges | (User32.BF)effects | User32.BF.ADJUST, ref contentRect); return(contentRect); }