system.drawing

How to take a screenshot of a WPF control?

守給你的承諾、 提交于 2019-11-26 08:16:26
问题 I created a WPF application using the Bing maps WPF control. I would like to be able to screenshot only the Bing maps control. Is use this code to make the screenshot: // Store the size of the map control int Width = (int)MyMap.RenderSize.Width; int Height = (int)MyMap.RenderSize.Height; System.Windows.Point relativePoint = MyMap.TransformToAncestor(Application.Current.MainWindow).Transform(new System.Windows.Point(0, 0)); int X = (int)relativePoint.X; int Y = (int)relativePoint.Y; Bitmap

Translate Rectangle Position in Zoom Mode Picturebox

一笑奈何 提交于 2019-11-26 06:49:43
问题 I\'m determining the rectangular area in an image and showing it to the user in a PictureBox. Since the image can sometimes be very large, I\'m using a PictureBox with its SizeMode set to Zoom . I\'m using the following code to translate the Rectangle (X, Y) coordinates: public Point TranslateZoomMousePosition(Point coordinates) { // test to make sure our image is not null if (pictureBox5.Image == null) return coordinates; // Make sure our control width and height are not 0 and our // image

A Generic error occurred in GDI+ in Bitmap.Save method

梦想与她 提交于 2019-11-26 05:28:03
问题 I am working on to upload and save a thumbnail copy of that image in a thumbnail folder. I am using following link: http://weblogs.asp.net/markmcdonnell/archive/2008/03/09/resize-image-before-uploading-to-server.aspx but newBMP.Save(directory + \"tn_\" + filename); is causing exception \"A generic error occurred in GDI+.\" I have tried to give permission on folder, also tried to use a new separate bmp object when saving. Edit: protected void ResizeAndSave(PropBannerImage objPropBannerImage) {

Alternatives to System.Drawing for use with ASP.NET?

。_饼干妹妹 提交于 2019-11-26 04:20:51
问题 After several days of tracking down bizarre GDI+ errors, I\'ve stumbled across this little gem on MSDN: Classes within the System.Drawing namespace are not supported for use within a Windows or ASP.NET service. Attempting to use these classes from within one of these application types may produce unexpected problems, such as diminished service performance and run-time exceptions. I don\'t know whether \"ASP.NET service\" means \"web application\" in this context, but \"diminished service