system.drawing

How to draw on top of the right-click menu in .NET/C#?

两盒软妹~` 提交于 2019-12-12 10:49:44
问题 I'm developing an assistive technology application (in C#) that overlays information on top of the currently open window. It detects clickable elements, and labels them. To do this, I'm currently creating a borderless, transparent window with TopMost set to "true", and drawing the labels on that. This means there is always a window hovering in front of the current application, on which I can draw the labels. The problem is, this window doesn't cover the right-click menu - only other windows.

Graphics.MeasureCharacterRanges giving wrong size calculations

不打扰是莪最后的温柔 提交于 2019-12-12 10:45:01
问题 I'm trying to render some text into a specific part of an image in a Web Forms app. The text will be user entered, so I want to vary the font size to make sure it fits within the bounding box. I have code that was doing this fine on my proof-of-concept implementation, but I'm now trying it against the assets from the designer, which are larger, and I'm getting some odd results. I'm running the size calculation as follows: StringFormat fmt = new StringFormat(); fmt.Alignment = StringAlignment

How do I pass a System.Drawing.Rectangle over WCF?

£可爱£侵袭症+ 提交于 2019-12-12 04:58:23
问题 I have a WCF service using a class namespace MyService { [DataContract] public class SomeResponse { [DataMember] public System.Drawing.Rectangle BoundingBox { get; set; } } } On client side, when I try to access the BoundingBox rectangle, the Rectangle changed its namespace from System.Drawing.Rectangle to MyServiceReference.Rectangle . I would expect the WCF framework to be clever enough to realize that System.Drawing.Rectangle also exists on client side and accordingly use the right

How to print a DataGrid in WPF, not a DataGridView

寵の児 提交于 2019-12-12 01:23:48
问题 "InvokePaint" is displaying error, "this" of the InvokePaint method is supposed to be a class, but i don't know which class it should be, any help will be appreciated. SqlDataAdapter da = new SqlDataAdapter("Select * from CallRegister", data.getCon()); DataTable dt = new DataTable("Call Reciept"); da.Fill(dt); DataGrid dg = new DataGrid(); dg.ItemsSource = dt.DefaultView; System.Drawing.Size m = new System.Drawing.Size((int)dg.Width, (int)dg.Height); System.Windows.Forms.PaintEventArgs

Sending file to print not working using System.Drawing.Printing

三世轮回 提交于 2019-12-12 01:22:39
问题 I'm trying to send a file to print without opening it trough Adobe as suggested by several Answers here; instead, I'm using the PrintQueue library (from System.Drawing.Printing ). What I've accomplished so far: I have the correct PrintQueue referenced as pq: PrintQueue pq; //Assume it's correct. The way to get here it isn't easy and it is not needed for the question. // Call AddJob PrintSystemJobInfo myPrintJob = pq.AddJob(); // Write a Byte buffer to the JobStream and close the stream Stream

Finding a line in an image file

若如初见. 提交于 2019-12-11 23:02:28
问题 I am trying to crop out the printer marks that are at the edges of a PDF. The path i want to take to solve this problem is as follows: Convert PDF into a bitmap and then traverse the bitmap and try to find the lines, then once the lines are found, find the coordinates of the edges of these lines, set the cropping coordinates to the coordinates just found. However the problems that pop up in my mind with this approach is how to know when the lines end and the actual page starts. How to

Is Azure App Service now supporting GDI+ (System.Drawing)?

喜你入骨 提交于 2019-12-11 17:18:19
问题 I've been dealing with deploying an API that uses System.Drawing for a few weeks. I had it running in an Azure App Service and I used to get a "GDI+ generic exception". Now, out of nowhere started working. I looked for Microsoft announcements but couldn't find anything. 回答1: GDI+ is still not supported now, please refer to here. A User voice has already been submitted. 来源: https://stackoverflow.com/questions/52364192/is-azure-app-service-now-supporting-gdi-system-drawing

Generic error occurred in GDI+ when disposing the bitmap

丶灬走出姿态 提交于 2019-12-11 16:58:10
问题 My code: var bitmap = new Bitmap(filePath); ... bitmap.Dispose(); <--- Fails here Out of 30k images in a folder (remote UNC share) , it failed on 2 files with the Generic error occurred in GDI+ when calling .Dispose . What are some of the reasons this could happen? 来源: https://stackoverflow.com/questions/56027141/generic-error-occurred-in-gdi-when-disposing-the-bitmap

Ambiguous reference between 'Microsoft.Xna.Framework.Color' & 'System.Drawing'

旧城冷巷雨未停 提交于 2019-12-11 15:00:04
问题 I think this is a simple question to answer, but I still can't figure out a way to get past it. Basically, what I wanted, was to use a Bitmap object in my Xna game. So I went ahead and added System.Drawing as an assembly reference. This worked out perfectly, except that I now get a different error; "'Color' is an ambiguous reference between 'Microsoft.Xna.Framework.Color' and 'System.Drawing'. How do I get past this? 回答1: The assembly reference alone doesn't lead to the error. It's the using

GetPixel method is not found

点点圈 提交于 2019-12-11 14:43:38
问题 I have a simple program, and ive included System.Drawing and I do not have an ability to use the GetPixel() method. It says its not found. What could be the reason for this? using System.Drawing; namespace isolatepixels { class Program { static void Main(string[] args) { System.Drawing.Image image1 = System.Drawing.Image.FromFile(@"C:\1.jpg"); int x, y; // Loop through the images pixels to reset color. for (x = 0; x < image1.Width; x++) { for (y = 0; y < image1.Height; y++) { Color pixelColor