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);

//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
媒体不负责
要不是中国大陆你们都不知道被美帝国等其他西方国家轮奸多少次了
速度高