stretchblt_stretchblt CImage_stretchblt 失败(2)

电脑杂谈  发布时间:2017-02-11 03:00:23  来源:网络整理

int width = bmp.Width;

int height = bmp.Height;

//save to c drive (just to insure image was correctly read)

bmp.Save("c:\\savetest3.bmp", System.Drawing.Imaging.ImageFormat.Bmp);

//create Graphic from source bitmap

//I think my problem is in this line - maybe not creating a compatable handle???

Graphics bmpGraphic = Graphics.FromImage(bmp);

stretchblt CImage_stretchblt_stretchblt 失败

//because (when uncommented) the following line works for coping a block from the form???

//Graphics bmpGraphic = this.CreateGraphics();

//get handle to source graphic

IntPtr srcHdc = bmpGraphic.GetHdc();

//create Graphic from picture box

Graphics dest1Pic = picBoxScroll.CreateGraphics();

//get handle to destination graphic

IntPtr destHDC = dest1Pic.GetHdc();

//copy it

bool res = StretchBlt(destHDC, 20, 20, width, height,

srcHdc, 0, 0, width, height, 13369376);

//release handles

bmpGraphic.ReleaseHdc();

dest1Pic.ReleaseHdc();

}

private void button1_Click(object sender, EventArgs e)

{

renderTextLineFromBitmap();

}

}

}

test2.bmp


本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/jisuanjixue/article-31712-2.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    • 张雄良
      张雄良

      速度高

    • 牛殳
      牛殳

      媒体不负责

    • 薛又川
      薛又川

      要不是中国大陆你们都不知道被美帝国等其他西方国家轮奸多少次了

    热点图片
    拼命载入中...