gdi+

GDI+ Generic Error ASP.NET MVC

Hello, I am having a GDI+ generic error I've tried what everyone says which is make sure that the folder containing the image file that is being read in like so public ImageResult ProfileAsset(string profile, int width, int height) { PhotoDB imgstr = new PhotoDB(); Image FullsizeImage = Image.FromFile( ...

Want to place several images with transparent colour on the same background

Hello! I am desparately searching for place several graphics having a transparent background on the same background with GDI+. I did not have any programming experience with Windows or graphic programming (like games) before, so it is more difficult to find a solution. GDI+ has a transparent colour. GDI+ only uses the transparency infor...

Loading, saving, and then loading an image again throws "A generic error occurred in GDI+"

This seems to be in infamous error. I remember getting it a while back for different code, but it's back, with a vengeance, but with some new code that I can't seem to figure out. It's definitely generic, for sure! The Goal I'm trying to build a form that allows a user to: Select an image. Press save (which closes the form), and save...

GDI+ DrawPolygon() excludes points outside viewable area and draws shape incorrectly.

I'm developing an application in MSVC++ 2003 (not using .Net at all) it's an older application uses GDI primarily. A lot of our function prototypes include a reference or pointer to a deviceContext in the parameter list. I figured that within any of those functions I can create a Grpahics object using Graphics.FromHDC(dc) and draw my s...

GraphicsPath, Control On Top

I have a custom C# user-control where I would like to draw a circle behind a textbox anchored to the centered bottom of the control. I'm drawing the circle like: protected override void OnResize(EventArgs e) { this.gp= new GraphicsPath(); this.gp.AddEllipse(0,0,width,height); //this is the width and height of the control this....

Weird behviour of creating graphics from a form's handle

EDIT: sorry, my bad, i forgot a line. and those are clean conditions (completely new project) Form frm = new Form(); Graphics graphics = Graphics.FromHwnd(frm.Handle); frm.FormBorderStyle = FormBorderStyle.None; frm.WindowState = FormWindowState.Maximized; frm.TransparencyKey = Color.Magenta; ...

Detecting coincident subset of two coincident line segments

This question is related to: How do I determine the intersection point of two lines in GDI+? (great explanation of algebra but no code) How do you detect where two line segments intersect? (accepted answer doesn't actually work) But note that an interesting sub-problem is completely glossed over in most solutions which just return nu...

Using System.Drawing, how can I draw something that imitates the effect of a yellow highlighting marker?

I want what's "behind" the yellow to show through. EDIT 1: But, if I'm drawing on "white", I'd like the marker color to retain its pure yellowness. EDIT 2: @Kevin's answer is probably correct, and I marked it correct, even though I didn't code it up. In my code, I'm settling for @Guffa's answer, using Color.FromArgb. ...

I have a bunch of GDI/GDI+ questions.

Just want to know if there's a forum dedicated to GDI/GDI+ or Windows graphics manipulation? Many thanks... ...

How can one scroll legitimately with GDI+?

Is there a preferred, fast method of scrolling within a user control in GDI+? I've created a control that graphically renders a horizontally scrollable data plot. Currently, my control operates by converting the position of a horizontal scroll bar into an offset into the data. The control then renders the data that exists between this...

GDI+ "Parameter is not valid." when set pen.Width

I have a System.Drawing.Pen _pen. When in some iterations is setting _pen.Width = 3 it gives me: System.ArgumentException Message="Parameter is not valid." Source="System.Drawing" - System.Drawing.dll StackTrace: at System.Drawing.Pen.set_Width(Single value) at MyProject.ctlPanneauGraphique.CustomLine.set_BorderWi...

Is there anything special I need to do to get the Paint message sent to a Control in C#?

I have three classes derived from Control...Class1, Class2 and Class3. Class1 is the parent. It contains a list of Class2 objects, which, in turn, each contain a list of Class3 objects. Each class overrides the OnPaint method to paint itself. Class1 and Class2 paint themselves fine but Class3.OnPaint is never called. Do I need to do...

Generic Error in GDI+ when calling Bitmap.getHBitmap()

I'm writing an application which as part of it draws an image on a Logitech G15v2 keyboard's LCD. For the most part the function works fine, but after a while of running, one of the lines throws a "Generic Error in GDI+" The problem, according to a stack trace, is in Bitmap.GetHbitmap(): at System.Drawing.Bitmap.GetHbitmap(Color backg...

Creating thumbnail of all the images inside a folder

I was trying to generate thumbnails using Bitmap.GetThumbnailImage() function for 20+ images in a folder. I could see huge memory spike by the application when it does the following procedure (about 600,000K in Task Manager mem usage). foreach (var image in ListOfImages) { var thumbnailFolder = @"\thumb"; var thumbnailFile = th...

BitBlt code not working

I'm trying to use this code to draw a Bitmap directly onto a PictureBox: Bitmap bmp = (Bitmap)Bitmap.FromFile(@"C:\Users\Ken\Desktop\Load2.bmp"); Graphics grDest = Graphics.FromHwnd(pictureBox1.Handle); Graphics grSrc = Graphics.FromImage(bmp); IntPtr hdcDest = grDest.GetHdc(); IntPtr hdcSrc = grSrc.GetHdc(); BitBlt(hdcDest, 0, 0, pictu...

Other ways to resize image than Graphics.DrawImage

Don't ask me why but i can't use this method because I need to create 2 image objects to make it work. I want to be able to resize a single Image object without needing to create another one. Is this possible and how? ...

System.Windows.Media.Imaging for asp.net

There are some very useful classes for working with images. I am stuck with gdi+ for now, I would like to use these classes for my web app. I tried to add a reference but I can't find the assembly. Any ideas if this is even possible? http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.aspx ...

"InvalidOperationException: Object currently in use" depending on control type

If I have the below code, everything will work - no exceptions. _imgOutput.Bitmap = _irViewAreaBitmap; ibxOutput.Image = _imgOutput; If instead of the above I did this (with everything else the same): pictureBox1.Image = _irViewAreaBitmap; I get an "InvalidOperationException: Object currently ...". I am confused because I would t...

About GDI/GDI+ coordinate compatibility?

Hi all, I have a problem while drawing with both GDI and GDI+ interchangably. The page transformationin particular scalingseems to be a little bit off between the two. Which properties of the GDI context affects the scaling of the output other than SetViewportExt and SetWindowExt? The code uses almost exclusively GDI for its drawing, b...

How to move a bitmap object around a screen, and have multiple objects using the same bitmap

See above. I need to move my bitmaps around a Form, or perhaps inside a PictureBox in a form. I have not been able to find any tutorials on this specific subject, and even the base GDI+ stuff is a bit confusing. I am looking for a simple and THOROUGHLY explained way on how to do this. I am needing this for a rendering engine for an 8-b...