Directory Freebies VS CheatSheet Forum

RSS

Email

Translate

Home About Archive Privacy Contact Advertise Write for Dev102
Posted by Shahar Y on Oct 9th, 2008 | Filed under .Net, C# | 13 Comments

Sometimes we need to know the width of a given string in pixels, do you know how to compute it? Before writing some long code, please notice that the .NET framework class library provides such a method. When Googling about this issue, we find the Graphics.MeasureString Method, here is how to use it:

Graphics graphics = this.CreateGraphics();
SizeF textSize = graphics.MeasureString("How long am I?", this.Font);

Nice isn’t it? Well, there is one little problem here, how is the Graphics object created? The written code is a Windows Forms code, so the this is the Form itself. You can’t create the Graphics object by simply allocating it because…


Continue Reading...
Posted by Shahar Y on Sep 9th, 2008 | Filed under .Net, Misc. | 21 Comments

tape-measureSoftware Managers all around the globe, need to have some metric to estimate their workers. Sometimes the management event wants to create a precise and measurable way to know the programming progress and the developers productivity and performance. One of those methods is called SLOC - Source Lines Of Code. This metric is used measure the size of the software by counting the lines of the program source code. Some managers tend to love SLOC because it can be automated so it requires very little effort and the effect of it can be visualized. That is exactly what managers like! it is easy and it can be easily inserted into their reports, what could be better than that? It seems just perfect.


Continue Reading...
Write Article for Dev102

Write for Dev102!

We pay for user submitted tutorials and articles that we publish. Anyone can send in a contribution

Learn More