public override void DrawParentBackground(Graphics graphics, Rectangle bounds, Control childControl) { using (var mh = ManagedHdc.FromGraphics(graphics)) { var rect = Win32.RECT.FromRectangle(bounds); UxTheme.DrawThemeParentBackground(_theme, mh.Hdc, ref rect); } }
public void DrawParentBackground(IDeviceContext dc, Rectangle bounds, Control childControl) { if (dc == null) { throw new ArgumentNullException(nameof(dc)); } if (childControl == null) { throw new ArgumentNullException(nameof(childControl)); } if (bounds.Width < 0 || bounds.Height < 0) { return; } if (childControl.IsHandleCreated) { using var wgr = new WindowsGraphicsWrapper(dc, AllGraphicsProperties); var hdc = new HandleRef(wgr, wgr.WindowsGraphics.DeviceContext.Hdc); RECT rc = bounds; lastHResult = UxTheme.DrawThemeParentBackground(childControl, hdc, ref rc); } }