Well, I didn't find anything on setting the colour key other than using masks but thats not what you asked for so I whipped up a method that can be used to set the alpha of a specified colour to zero for you:
// Sets the colour key to be used for a Texture2D object
protected Texture2D SetColourKey(Texture2D texture, Color colourKey)
{
// Make sure the texture has been loaded
if (texture != null)
{
// Get the untouched pixel data
Color[ pixels = new Color[texture.Height * texture.Width];
texture.GetData<Color>(pixels);
// Loop through all rows for the current texture
for (int i = 0; i < texture.Height; i++)
{
// Iterate through all the columns in the current row
for (int j = 0; j < texture.Width; j++)
{
// Work out what pixel we are working with
int offset = ((i * texture.Width) + j);
// Set the alpha to zero (transparent) if the colour
// of the pixel is the colour we specified as the
// colour key
if (pixels[offset] == colourKey)
pixels[offset] = new Color(0, 0, 0, 0);
}
}
// Apply the changes to the textures pixel data
texture.SetData<Color>(pixels);
}
// Return the results
return texture;
}
Just call it after loading your texture like so:
testTexture = Content.Load("test");
testTexture = SetColourKey(testTexture, Color.Black);
It work pretty well but it doesn't keep track of the last colour key, so if you set the colour key to black, then later on change the colour key to green, both colours will be used as the colour key. It can serve as a base for you, if you want to take it further you might want to extend the Texture2D class to implement colour keys. Good luck =]
EDIT: There may be a few typos due to the forums removing certain characters, I think the forum needs a source tag for posting code and keeping it formatted =]