zoukankan      html  css  js  c++  java
  • C# Panel控件截图

    [System.Runtime.InteropServices.DllImportAttribute("gdi32.dll ")]
            private static extern bool BitBlt(
            IntPtr hdcDest, // handle to destination DC 
            int nXDest, // x-coord of destination upper-left corner 
            int nYDest, // y-coord of destination upper-left corner 
            int nWidth, // width of destination rectangle 
            int nHeight, // height of destination rectangle 
            IntPtr hdcSrc, // handle to source DC 
            int nXSrc, // x-coordinate of source upper-left corner 
            int nYSrc, // y-coordinate of source upper-left corner 
            System.Int32 dwRop // raster operation code 
            );
    Graphics g1 = panel1.CreateGraphics(); 
                Image myImage = new Bitmap(this.panel1.Width, this.panel1.Height, g1); 
                Graphics g2 = Graphics.FromImage(myImage); 
                IntPtr dc1 = g1.GetHdc(); 
                IntPtr dc2 = g2.GetHdc(); 
                BitBlt(dc2, 0, 0, this.panel1.Width, this.panel1.Height, dc1, 0, 0, 13369376); 
                g1.ReleaseHdc(dc1); 
                g2.ReleaseHdc(dc2); 
                myImage.Save(@"NewImage.bmp ", ImageFormat.Bmp);
  • 相关阅读:
    我与solr(二)--导入mysql数据库
    Android 渐变效果
    希尔排序
    插入排序
    选择排序
    冒泡排序法
    QT仿QQ页面
    Colliding Mice
    QTablewidget通过代理实现限制输入
    QT绘制心形图案二
  • 原文地址:https://www.cnblogs.com/sunqiliang/p/5278301.html
Copyright © 2011-2022 走看看