A Few of My Favorite Things…in Visual Studio 2010

Since my last post I’ve switched from Visual Studio 2008/.Net 3.5 to VS 2010/.Net 4.0 for most of my day-to-day work.  I haven’t had time to explore them thoroughly, but there are a couple of things that I really like. The first is that optional parameters have been added to C#.  There haven’t been many…

0

AssemblyFileVersionAttribute and AssemblyVersionAttribute: A subtle difference

The AssemblyInfo.cs file generated by Visual Studio contains the following lines: // Version information for an assembly consists of the // following four values://// Major Version// Minor Version // Build Number// Revision//// You can specify all the values or you can default the Build // and Revision Numbers// by using the ‘*’ as shown below://…

0

Visual Studio Tip of the Day

  I want to give a quick shout-out to Sara Ford and Zain Naboulsi for their great Visual Studio tips.  If you use VS in your day-to-day work, you owe it to yourself to browse these blogs: there’s sure to be a thing or five that will save you time and effort.  I believe there…

0

Poor Man’s Guide Lines for Visual Studio’s Windows Forms Editor

  The custom control I’ve been working on required drawing custom shapes on each side of the control.  The shapes needed to be the same size and I was sure that one was a couple of pixels shorter than the other, but it was difficult to tell with the naked eye.  I was wishing that…

1

Why does retrieving resources have to be so difficult? Oops, it’s not…

Loading embedded resources at runtime has always mystified me.  Should I use the ComponentResourceManager class?  Should I try to find the ResourceStream in the assembly?  And what’s the correct name to use to identify it?  Is it simply the file name? Or is it the name of the default namespace plus the filename?  Or do…

0

C# Extension Methods: Syntactic Sugar or Useful Tool?

Last week a colleague introduced me to extension methods (C#, VB) in .Net. If you’re not familiar with extension methods, they were added in Visual Studio 2008 to provide a means for adding functionality to existing types without creating a new derived type. Extension methods are called as if they were instance methods of the…

0

Hiding a non-virtual property for a derived control at design-time

I’ve recently been developing a custom control (BarControl) that derived from an existing control (FooControl). There were two requirements related to the derived control’s border style: The BorderStyle property should not be modified at runtime The BorderStyle property should not be displayed in the Properties pane at design-time Since the base control exposed a BorderStyle…

0

Back in Business

After a hiatus of 3+ years, I’ve decided to reopen blue collar.  The focus will no longer be the .Net Compact Framework, but will still be aimed at providing information and solutions that will save time and effort for developers delivering solid code on a daily basis.  If you find these articles useful, please let…

1

Adding Compact Framework Design-Time Attributes, or More Fun With TextBoxes

A common user-interface feature is to select the contents of a text-box when the textbox gets focus. The CF textbox control doesn’t do this by default but it’s not difficult to add with managed code. While I’m at it, I’ll add a SelectTextOnFocus property to the textbox’s property window so the developer can determine at…

1

Setting Alignment in TextBoxes…No Looking Glass Required

In yesterday’s post I stated that “non-character keys do not trigger KeyPress events.” While that is perfectly true, I misunderstood what was meant by a non-character key. In the non-managed Win32 world, pressing a key generates a WM_KEYDOWN, one or more WM_CHAR messages, and a WM_KEYUP message. The managed KeyPress event corresponds to the WM_CHAR…

0