Update: A better solution!

I continued to work on this problem, and now I have found a way to use the original bitmaps. In fact, since I am only dealing with a hatch pattern (2 colors), I can change the bitmaps to 2 color mode (PixelFormat.Format1bppIndexed)!

All it requires is to change the palette information to use the new color(s), then lock the bitmap into memory, then unlock it again. Here is a modified example:

Code:
      public static Image LoadHatchPattern(int index, Color foreground)
      {
// Create a bitmap from an embedded resource bitmap file.
         Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream("Designer.Textures.Hatch1.bmp");
         Bitmap b = new Bitmap(s);
 
// Change out the first color (Black in the original Black & White bitmap) in the palette
         ColorPalette pal = b.Palette;
         pal.Entries[0] = foreground;
         b.Palette = pal;
 
// Lock and then unlock the bitmap data
         BitmapData data = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadWrite, b.PixelFormat);
         b.UnlockBits(data);
 
// Make the background color transparent
         b.MakeTransparent();
 
         return b;
      }
This works exactly the way I want it to, and now I can use B&W 2 color bitmaps, which are much smaller!

NOTE: I could pass the background color to this function, then add the line below to change out the background color as well. If I do this, I would then remove the call to "b.MakeTransparent()", since I am specifying the background color.


Code:
pal.Entries[1] = background;