gpt4 book ai didi

c# - Windows xp 上的 DrawToBitmap

转载 作者:太空宇宙 更新时间:2023-11-03 16:30:41 32 4
gpt4 key购买 nike

我有一个显示车牌号的用户控件(它包含背景图像和一些文本框),我使用 DrawToBitmap() 方法获取此控件的位图并显示位图在我的表单上,它在 Windows 7 上运行良好,但在 Windows XP Service Pack 3 中仅绘制背景图像而未绘制文本框中的文本,我该怎么办?

var clt = new ControlLisenceTouch();Bitmap b = new Bitmap(clt.Width, clt.Height);
clt.License = License.FromCar(someCar);
clt.Invalidate(true);
clt.DrawToBitmap(b, Rectangle.FromLTRB(0, 0, clt.Width, clt.Height));
pictureBox1.Image = b;

最佳答案

这个人遇到了同样的问题,虽然答案并不完美,但确实适合他。这里最大的问题是,如果另一个窗口覆盖了您的控件,那么该窗口也会显示。看看我的回答,第三个编辑显示截屏,并从中裁剪出一个控件。

How can I get a screenshot of control? DrawToBitmap not working

根据 http://msdn.microsoft.com/en-us/library/system.windows.forms.control.drawtobitmap.aspx
完全支持 Windows XP sp3

关于c# - Windows xp 上的 DrawToBitmap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10894921/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com