7
在GDI +的WinForms,我會做:如何在WPF中直接繪製位圖(BitmapSource,WriteableBitmap)?
Bitmap b = new Bitmap(32,32);
Graphics g = Graphics.FromImage(b);
//some graphics code...`
如何做同樣的事情在WPF,用的DrawingContext?
在GDI +的WinForms,我會做:如何在WPF中直接繪製位圖(BitmapSource,WriteableBitmap)?
Bitmap b = new Bitmap(32,32);
Graphics g = Graphics.FromImage(b);
//some graphics code...`
如何做同樣的事情在WPF,用的DrawingContext?
您可以使用RenderTargetBitmap將任何WPF內容呈現爲位圖,因爲它本身是BitmapSource
。有了這個,你可以使用standard drawing operations in WPF來「繪製」一個位圖。