zoukankan      html  css  js  c++  java
  • WPF中绘图(含调用GDI+)

    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;
                //}
            }

  • 相关阅读:
    Linux下命令设置别名--alias(同实用于mac)
    mac 下配置连接Linux服务器方法,上传下载文件操作
    Jdbc和工具类
    MySQL和数据库
    validate和bootstrap学习
    jQuery学习
    JavaScripe学习
    CSS学习
    HTML学习
    Metail Design入门(一)
  • 原文地址:https://www.cnblogs.com/gispathfinder/p/11090387.html
Copyright © 2011-2022 走看看