2

I have a user control that shows plate number of a vehicle(it contains a background image and some TextBoxes), I use DrawToBitmap() Method to get a bitmap of this control and show the bitmap on my form, It works fine on Windows 7 but in Windows XP service pack 3 only background image is drawn and texts in textboxes are not drawn, what should I do?

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

1 回答 1

0

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

如何获得控制截图?DrawToBitmap 不工作

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

于 2012-06-05T11:00:34.017 回答