WPF中绘图(含调用GDI+)
2024-09-05 16:29:13
private void DrawStuff()
{
//
//if (buffer == null)
//{
// buffer = new RenderTargetBitmap((int)Background.Width, (int)Background.Height, 96, 96, PixelFormats.Pbgra32);
// Background.Source = buffer;
// return;
//}
//using (DrawingContext drawingContext = drawingVisual.RenderOpen())
//{
// drawingContext.DrawRectangle(new SolidColorBrush(Colors.Red), null, new Rect(0, 0, 10, 10));
//}
//buffer.Render(drawingVisual);
} private void DrawImage() {
//
// layoutDocumentMapContainer
//if (dockPanelMapContainer.ActualWidth <1 || dockPanelMapContainer.ActualHeight < 1 || this.Background == null)
//{
// return;
//}
//using (Bitmap bitmap = new Bitmap((int)dockPanelMapContainer.ActualWidth, (int)dockPanelMapContainer.ActualHeight))
//{
// this.Background.Visibility = Visibility.Visible;
// this.Background.Width = (double)bitmap.Width;
// this.Background.Height = (double)bitmap.Height;
// Graphics graphics = Graphics.FromImage(bitmap);
// graphics.FillRectangle(new System.Drawing.SolidBrush(System.Drawing.Color.Blue), new RectangleF(0, 0, (float)(dockPanelMapContainer.ActualWidth - 0), (float)(dockPanelMapContainer.ActualHeight - 0)));
// MemoryStream memoryStream = new MemoryStream();
// bitmap.Save(memoryStream, ImageFormat.Png);
// memoryStream.Position = 0L;
// BitmapImage bitmapImage = new BitmapImage();
// bitmapImage.BeginInit();
// bitmapImage.StreamSource = memoryStream;
// bitmapImage.EndInit();
// this.Background.Source = bitmapImage;
// graphics.Dispose();
// graphics = null;
//}
}
最新文章
- [LintCode] Best Time to Buy and Sell Stock 买卖股票的最佳时间
- c语言中在引用math库后,编译出现错误(.text+0x9c):对‘sqrt’未定义的引用的解决办法
- gvim 快速编辑例子
- phpinfo() 中 Local Value(局部变量)Master Value(主变量) 的区别
- zoj 1789 The Suspects
- android ListView和GridView拖拽移位具体实现及拓展
- js基础例子
- sql server 规则
- Handlebars.js 模板引擎
- CentOSv6.8 修改防火墙配置、修改SSH端口
- 纠错:基于FPGA串口发送彩色图片数据至VGA显示
- [SCOI2007]最大土地面积
- [AHOI 2016初中组]自行车比赛
- 996.ICU与死亡因素
- 20175314 《Java程序设计》第八周学习总结
- 解决小程序webview缓存机制
- Beta冲刺 (3/7)
- freeRTOS中文实用教程5--内存管理
- ThinkingInJava 学习 之 0000006 复用类
- (1)Python3笔记 数据类型之Number与String