Click here to Skip to main content
15,885,546 members
Articles / Programming Languages / C#

VSEDebug - VS.NET Debugging Enhancement

Rate me:
Please Sign up or sign in to vote.
4.92/5 (37 votes)
25 Apr 20049 min read 169.3K   2.2K   58  
VSEDebug is a VS.NET debugger add-in that adds the ability to debug complex types in simpler form.
//  � Copyright 2002, Pierre ARNAUD, OPaC bright ideas, Switzerland.
//    All rights reserved.

namespace SynapticEffect.Forms.Helpers
{
	public class StringTools
	{
		private StringTools() { }
		
		static public System.Drawing.SizeF MeasureDisplayString(System.Drawing.Graphics graphics, string text, System.Drawing.Font font)
		{
			const int width = 32;
			
			System.Drawing.Bitmap   bitmap = new System.Drawing.Bitmap (width, 1, graphics);
			System.Drawing.SizeF    size   = graphics.MeasureString (text, font);
			System.Drawing.Graphics anagra = System.Drawing.Graphics.FromImage (bitmap);
			
			int measured_width = (int) size.Width;
			
			if (anagra != null) 
			{
				anagra.Clear (System.Drawing.Color.White);
				anagra.DrawString (text+"|", font, System.Drawing.Brushes.Black, width - measured_width, -font.Height / 2);
				
				for (int i = width-1; i >= 0; i--)
				{
					measured_width--;
					if (bitmap.GetPixel (i, 0).R == 0) 
					{
						break;
					}
				}
			}
			
			return new System.Drawing.SizeF (measured_width, size.Height);
		}
		
		static public int MeasureDisplayStringWidth(System.Drawing.Graphics graphics, string text, System.Drawing.Font font)
		{
			return (int) MeasureDisplayString (graphics, text, font).Width;
		}	
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
I'm a student at the University of Florida studying computer engineering.

You may find additional information about vsedebug at http://vsedebug.sourceforge.net

Comments and Discussions