0

Possible Duplicate:
Combine two Images into one new Image

I have a c# code that creates 2 images; now I want to join them by placing first image above the second image?

This is what I have done so far:

        var myBitmap = new Bitmap(longestLine * 40, 40);
        var g = Graphics.FromImage(myBitmap);
        g.Clear(Color.White);
        var strFormat = new StringFormat { Alignment = StringAlignment.Center };
        g.DrawString(FirstLine, new Font("Free 3 of 9", 40), Brushes.Black, new RectangleF(0, 0, longestLine * 40, totalLines * 40), strFormat);

        var myBitmap2 = new Bitmap(longestLine * 40, 40);
        var g2 = Graphics.FromImage(myBitmap2);
        g2.Clear(Color.White);
        var strFormat2 = new StringFormat { Alignment = StringAlignment.Center };
        g2.DrawString(SecondLine, new Font("Free 3 of 9", 40), Brushes.Black, new RectangleF(0, 0, longestLine * 40, totalLines * 40), strFormat);
Community
  • 1
  • 1
Andrew
  • 7,619
  • 13
  • 63
  • 117
  • You might start here to figure out how to combine two side by side http://stackoverflow.com/questions/7206510/combine-two-images-into-one-new-image – MikeB Oct 01 '12 at 17:28
  • Perfect! Worked like a charm! Answer and I will pick it as the right answer – Andrew Oct 01 '12 at 17:36

1 Answers1

1

Combine two Images into one new Image was used for adding two bitmaps side by side. I've used it myself, and it seems to work just fine.

Community
  • 1
  • 1
MikeB
  • 2,402
  • 1
  • 15
  • 24