0

I'm currently trying to draw a black rectangle over an image, but it just wont go to the bottom of the image. If I try to push it down, it just fills the image with the black rectangle.

Here's my code:

public void AddTextToImage(string LabelText, string CardNo)
{
BitMap LabelImage = new BitMap("C:\ImageLocation");
int32 y = Convert.toInt32(CardNo;
int32 x = LabelImage.Width;

Rectangle rec = new Rectangle(Convert.ToInt32(LabelText), Convert.ToInt32(CardNo, LabelImage.Width, 250);

\\Mainly been playing with the numbers, can't figure out the right coordinates though
graphic.DrawRectangle(new Pen(Color.Black, LabelImage.Width), 0, -200, LabelImage.Width, y);

graphic.DrawString(LabelText, new Font("Tahoma", 40), Brushes.Black, new System.Drawing.Point(0,y));

picImage.Image = LabelImage;

}
David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
Joel R
  • 79
  • 8

1 Answers1

0

Don't use -200. It will be outside the image

 graphic.DrawRectangle(new Pen(Color.Black, LabelImage.Width), 0, 200, LabelImage.Width, y);
Fun Mun Pieng
  • 6,751
  • 3
  • 28
  • 30