为什么使用 'RenderTargetBitmap' class 会使 GDI 句柄数增加?

Why the use of 'RenderTargetBitmap' class makes GDI handle count increase?

我的理解

1) 'System.Windows.Media'里面的类使用directx进行渲染。 它不会使用 GDI+。 2) 'System.Drawing'中只有类使用GDI+绘图。(这会导致GDI句柄数增加。)

问题

但是当我使用 'System.Windows.Media.Imaging.RenderTargetBitmap' 渲染位图时,GDI 计数似乎增加了。

为什么会这样?

(因为我需要将这些图像放在一个按钮上,而这个按钮是网格控件的单元格模板的一部分,所以我想减少 GDI 的使用。)

DrawingVisual drawingVisual = new DrawingVisual();
DrawingContext drawingContext = drawingVisual.RenderOpen();
// Create Rectangle
Rect rect = new Rect(new System.Windows.Point(0, 0), new System.Windows.Point(100, 100));
// Draw Rectangle
System.Windows.Media.Pen pen = new System.Windows.Media.Pen();
pen.Brush = Brushes.Black;
pen.Thickness = 5;
drawingContext.DrawRectangle(Brushes.Black, pen, rect);             
drawingContext.Close();
RenderTargetBitmap bmp = new RenderTargetBitmap(100, 100, 96.0, 96.0, PixelFormats.Pbgra32);
//Render DrawingVisual 
bmp.Render(drawingVisual);

通过网络和一些分析,RenderTargetBitmap 似乎没有利用硬件渲染(Direct X)。它仍然使用 GDI+ 离线渲染位图。

这可能是对 WPF 渲染的普遍理解的例外。 但令我惊讶的是,MSDN 并未提供任何相关线索。