system.drawing

WinForms too many handles

别说谁变了你拦得住时间么 提交于 2019-12-11 14:26:13
问题 I our production, my application caused two different exceptions: System.ArgumentException: Invalid Parameter. at System.Drawing.Image.get_RawFormat() at System.Windows.Forms.ToolStripItem.set_Image(Image value) at Zeiss.IMT.IME.CmmUI.Tools.ToolControl.updateControls() There is another exception that i suppose to have the same cause: System.ComponentModel.Win32Exception: The operation completed successfully at System.Drawing.BufferedGraphicsContext.CreateCompatibleDIB(IntPtr hdc, IntPtr hpal,

GetRoundedRegion exception

╄→гoц情女王★ 提交于 2019-12-11 12:29:44
问题 I made a custom button with rounded edges, i use CreateRoundRectRgn for this, in the paint event this is called to round all the edges, when i run my program everything works fine until after about one minute, then i get the following exception(the value of p = 0): one thing to add is that the button is undergoing about 50 paint events per second because of a color fade (blinking) this is my paint event: protected override void OnPaint(PaintEventArgs e) { this.SuspendLayout(); this.Region =

Getting Same Rectangle Position from Scaled Small Size Image

人走茶凉 提交于 2019-12-11 12:18:22
问题 I'm trying to process a large size image.Since the processing takes too much time to complete i'm resizing the image prior processing.After processing i'm drawing a rectangle on the small size image.How can i translate the the coordinates of this rectangle to original unscaled image ie:Draw the rectangle at the same position on the unscaled image. I'm using the following code to resize the image public static Size ResizeKeepAspect(Size CurrentDimensions, int maxWidth, int maxHeight) { int

Overlay image with PNG as mask using .Net and Javascript

*爱你&永不变心* 提交于 2019-12-11 10:35:54
问题 I have a project I am working on where the user can upload a frame image in PNG format. After they upload the frame they can upload a photo that will be placed behind the frame. The photo can be resized and moved so they can fit their photo into the frame. Once they are happy with their work, they can save their work. The canvas is a fixed size on the client. This is an ASP.Net MVC4 application and we are using JavaScript / JQuery. I have only worked a little with the System.Drawing library

VB.NET: Finding the size of text to be drawn, before it is drawn to a control

六月ゝ 毕业季﹏ 提交于 2019-12-11 07:58:02
问题 I'm creating a user control and adding a text size property to it. I need to know how big the text size is going to be before drawing it on the control so that I can center it on the control in relation to its height and width. I'm under the assumption that this is a windows API command. However I have not been able to locate any information on it. Public Sub DrawImage(ByVal gr As Graphics) If Me.Image Is Nothing Then Return Dim r As Rectangle = New Rectangle(8, 8, Me.ImageSize.Width, Me

spring like drawing in c#

旧巷老猫 提交于 2019-12-11 05:56:39
问题 How to draw the spring like shape using c# drawing class alt text http://img812.imageshack.us/img812/373/spring.jpg 回答1: This is more of a math problem than a C# one. What you want is to derive a Parametric equation for the curve you wish to draw. With that go and fill an array of Point objects with values for the parametric equation on a certain interval with a certain step (the smaller the step the more the final drawing will look like the actual shape). Then you can use g.DrawLines (MSDN:

Render multiple Image Layers to transparent PNG image

女生的网名这么多〃 提交于 2019-12-11 05:29:47
问题 Not exactly sure how to word this question, so I will go on to explain the details, and try to ask as best I can form it. I have a project which consists of the following components Canvas - Inherits PictureBox control Layers - A collection of "Layer" Layer - Can contain a collection of Graphics as Images with information. Each layer can be moved and the selection box for the layer is constrained to the portion of the layer which contains graphics at maximum bounds. All of the above is

Load a bitmap from file in RGB format (without alpha)

不羁的心 提交于 2019-12-11 03:34:02
问题 i simply want to load a .BMP file and get the Bitmap object in 24bit RGB format (or 32bit in RGB format). All methods I tried return a Bitmap/Image object with PixelFormat = Format32bppArgb. Even if of course BMPs don't have alpha. new Bitmap(System.Drawing.Image.FromFile(fileName, true)); new Bitmap(fileName); I currently solve the problem by copying the first object to another in memory bitmap at 24bit RBG. Is there a single method to do it? Thanks 回答1: As far as I can tell it is not

Edit multipage TIFF image using System.Drawing

你离开我真会死。 提交于 2019-12-11 02:52:18
问题 I'm tring to edit multipage tiff by creating Graphics from the image, but i encountered the error message: “A Graphics object cannot be created from an image that has an indexed pixel format.” How can i edit multipage tiff? 回答1: The error : A Graphics object cannot be created from an image that has an indexed pixel format. ...has nothing to do with it being a multipage TIFF. An indexed image format means it has a palette of colours, e.g. it's a 256-colour image. A 1-bit image (B&W) would also

Using System.Drawing.Printing to get Queue Status

荒凉一梦 提交于 2019-12-11 02:44:57
问题 I've been trying to use System.Drawing.Printing; in order to get the queue status of a network printer. I can retrieve the properties of the printer but I can't really seem to get the queue status. This is what I've tried so far: PrinterSettings ps = new PrinterSettings(); ps.PrinterName = "ES5461 MFP(PCL)"; // Load the appropriate printer's setting From there I can see that the Printer is valid since ps.IsValid is true but I can't go any further. I've tried as well to use System.Management