tagged [gdi]

TextRenderer.MeasureText and Graphics.MeasureString mismatch in size

TextRenderer.MeasureText and Graphics.MeasureString mismatch in size This is not a rounding problem. Difference ~ 5+ pixels. Test Case String: ""MACD (26,12,9) -0.000016" The result is always:

15 Jul at 09:43

How to convert Bitmap to Image

How to convert Bitmap to Image I am making a median filter, the problem is manipulating pixes are only possible in `Bitmap`. Later I want to show the result in a `PictureBox` which uses `Image`. I can...

3 May at 15:31

How do I determine the intersection point of two lines in GDI+?

How do I determine the intersection point of two lines in GDI+? I'm using .NET to make an application with a drawing surface, similar to Visio. The UI connects two objects on the screen with Graphics....

23 Dec at 17:34

Measure a String without using a Graphics object?

Measure a String without using a Graphics object? I am using pixels as the unit for my font. In one place, I am performing a hit test to check if the user has clicked within the bounding rectangle of ...

16 Jun at 19:3

C# - Faster Alternatives to SetPixel and GetPixel for Bitmaps for Windows Forms App

C# - Faster Alternatives to SetPixel and GetPixel for Bitmaps for Windows Forms App I am trying to teach myself C# and have heard from a variety of sources that the functions get and setpixel can be h...

29 Dec at 02:37

myBitmap.RawFormat is something different than any known ImageFormat?

myBitmap.RawFormat is something different than any known ImageFormat? I'm working with GDI+ and I create a new bitmap like this: now when I observe its RawFormat.Guid I see that it is different from a...

4 Aug at 15:38

How do I draw a rectangle onto an image with transparency and text

How do I draw a rectangle onto an image with transparency and text This is my first graphics based project and to begin with I need to be able to draw a rectangle onto a bitmap with transparency and t...

8 Apr at 21:49

A generic error occurred in GDI+ at System.Drawing.Image.Save

A generic error occurred in GDI+ at System.Drawing.Image.Save > We convert a base64 string into a MemoryStream and then create a System.D

28 Mar at 09:46

Why does EnumerateMetafile only work with Aero enabled

Why does EnumerateMetafile only work with Aero enabled My code [enumerates](http://msdn.microsoft.com/en-US/library/system.drawing.graphics.enumeratemetafile(v=vs.110).aspx) a metafile: ``` private vo...

19 May at 09:32

When is Dispose necessary?

When is Dispose necessary? When you have code like: ``` Bitmap bmp = new Bitmap ( 100, 100 ); Graphics g = Graphics.FromImage ( bmp ); Pen p = new Pen ( Color.FromArgb ( 128, Color.Blue ), 1 ); Brush ...

Bad text rendering using DrawString on top of transparent pixels

Bad text rendering using DrawString on top of transparent pixels When rendering text into a bitmap, I find that text looks very bad when rendered on top of an area with non-opaque alpha. The problem i...

Crop/Remove Unwanted Space at the edges of image

Crop/Remove Unwanted Space at the edges of image I have search a lot to remove the unwanted space but could not found. I only found links which can used to remove black and white background space. But...

17 Jun at 12:56

How to determine the size of the button portion of a Windows radio button

How to determine the size of the button portion of a Windows radio button I'm drawing old school (unthemed - themed radios are a whole other problem) radio buttons myself using DrawFrameControl: I've ...

14 Sep at 23:59

How to stitch images with very little overlap?

How to stitch images with very little overlap? I am trying to create a panorama using images with very little overlap, but I know the angle of the camera so I know exactly how much overlap there is an...

30 Dec at 21:53

Using custom TTF font for DrawString image rendering

Using custom TTF font for DrawString image rendering I am using GDI+ on the server-side to create an image which is streamed to the user's browser. None of the standard fonts fit my requirements and s...

15 Jan at 14:6

How to effectively draw on desktop in C#?

How to effectively draw on desktop in C#? I want to draw directly on the desktop in C#. From searching a bit, I ended up using a Graphics object from the Desktop HDC (null). Then, I painted normally u...

23 May at 11:47

What is causing Calibri to lose ClearType between 9 and 14 pt?

What is causing Calibri to lose ClearType between 9 and 14 pt? What exactly is it that makes GDI+ switch to binary aliasing when using default Microsoft Office font Calibri between 9pt and 14pt with C...

1 May at 19:48

How to set the default value of Colors in a custom control in Winforms?

How to set the default value of Colors in a custom control in Winforms? I got the value to show up correctly using: But after I reload the project the control is used, this value is set to White, whic...

5 Oct at 21:36

GraphicsPath AddString not support enough to the font when use right to left language if operating system lower than Win10

GraphicsPath AddString not support enough to the font when use right to left language if operating system lower than Win10 I need to `generate an image from a string` in my WPF application, and show i...

24 Apr at 21:23

Drawing text in .NET

Drawing text in .NET I'm doing some tests about drawing text in .Net and I had the following results. ![Drawing text example](https://i.stack.imgur.com/bRcps.png) - `FlatStyle``System`- [Graphics.Draw...

1 Sep at 10:29

Should I create new Pens/Brushes per Paint request or keep them throughout the application lifecycle?

Should I create new Pens/Brushes per Paint request or keep them throughout the application lifecycle? I have an application that does a of drawing, let's pretend it's a Viso-like application. It has o...

20 Aug at 16:51

How to draw rounded rectangle with variable width border inside of specific bounds

How to draw rounded rectangle with variable width border inside of specific bounds I have a method that draws a rounded rectangle with a border. The border can be any width, so the problem I'm having ...

9 Mar at 22:21

How to find reason for Generic GDI+ error when saving an image?

How to find reason for Generic GDI+ error when saving an image? Having a code that works for ages when loading and storing images, I discovered that I have that breaks this code: The exception is: > S...

18 Sep at 04:59

Problem reading JPEG Metadata (Orientation)

Problem reading JPEG Metadata (Orientation) I've got a JPEG image which was taken on an iphone. On my desktop PC (Windows Photo Viewer, Google Chrome, etc) the orientation is incorrect. I'm working on...

3 Jun at 01:15

Image resize with GDI in .NET gives low saturation

Image resize with GDI in .NET gives low saturation I'm fighting an issue where my resized images looses color saturation when I manipulate them using GDI. I'm loading an JPG as original, resize it and...

16 Oct at 09:56