We pay for user submitted tutorials and articles that we publish. Anyone can send in a contributionLearn More
Tab menus are a fairly common thing that I use in a lot of my applications. I like tabs because they help break up large chunks of, usually, related information.
At work we use RadControls for Telerik and they have a pretty nice tab menu control that is easy to use and looks good too. The only problem with these controls is that they only work in WebForms like even the default ASP.NET controls. So when I started playing with MVC I quickly realized I would need to spend some time building some of these controls myself.
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…
Here is something neat I found out.
Say you are writing an application and one of the requirements is to allow File System search. You could always start using loops and such. I thought to myself why not do it in LINQ? I played around with it and in fact it is not so hard.
Lets see how it is done. Here is method that allows finding a specific file name in side a directory.
Basically we Query the FileInfo which is returned from the GetFiles() method and compare the file name.
Recently, I ran into a great free Microsoft tool which is called – Resource Refactoring Tool. This tool provides developers an easy way to extract hard coded strings from the code to resource files. Resource files (.resx files) consists of XML entries, which specify objects and string inside XML tags. Those files can be opened […]
Lately I took part in several code reviews and I noticed that whenever people need to extract the month name from the datetime object many different solutions are presented. Some of the solutions were not very successful, so I decided to shed some light on this issue through an example. These are the most common […]
Extention Methods are a very useful tool we just got in C# 3.0. We could define them as static methods that extend existing classes, Even System classes!!! If we wanted to do something like that in the past we had to derive from the selected class and extend it with whatever we wanted. But what […]
Copyright © 2012 Dev102.com
Breeze : Designed by Amit Raz and Nitzan Kupererd