GDI+ / C#: How to save an image as EMF?

Image is an abstract class: what you want to do depends on whether you are dealing with a Metafile or a Bitmap. Creating an image with GDI+ and saving it as an EMF is simple with Metafile. Per Mike’s post: var path = @”c:\foo.emf” var g = CreateGraphics(); // get a graphics object from your … Read more

Drawing a transparent button

WinForms (and underlying User32) does not support transparency at all. WinForms however can simulate transparency by using control style you provide – SupportsTransparentBackColor, but in this case all that “transparent” control does, it to allow drawing parent its background. ButtonBase uses some windows styles that prevent working this mechanism. I see two solutions: one is … Read more

JPEG 2000 support in C#.NET

Seems like we can do it using FreeImage (which is free) FIBITMAP dib = FreeImage.LoadEx(“test.jp2”); //save the image out to disk FreeImage.Save(FREE_IMAGE_FORMAT.FIF_JPEG, dib, “test.jpg”, FREE_IMAGE_SAVE_FLAGS.JPEG_QUALITYNORMAL); //or even turn it into a normal Bitmap for later use Bitmap bitmap = FreeImage.GetBitmap(dib);

Drawing a Long String on to a Bitmap results in Drawing Issues

When drawing a string of characters (ASCII or a form of Unicode encoded symbols) using Graphics.DrawString() with a fixed sized Font, the resulting graphics appear to generate a sort of grid, degrading the visual quality of the rendering. A solution is to substitute the GDI+ Graphics methods with the GDI methods, using TextRenderer.MeasureText() and TextRenderer.DrawText(). … Read more

Graphics.DrawString vs TextRenderer.DrawText?Which can Deliver Better Quality

i’m going to cross-post my answer from over here, just so that the information gets around. There are two ways of drawing text in .NET: GDI+: graphics.MeasureString and graphics.DrawString GDI: TextRenderer.MeasureText and TextRenderer.DrawText In .NET 1.1 everything used GDI+ for text rendering. But there were some problems: There are some performance issues caused by the … Read more