0

我目前正在尝试在图像上绘制一个黑色矩形,但它不会到达图像的底部。如果我尝试将其向下推,它只会用黑色矩形填充图像。

这是我的代码:

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;

}
4

1 回答 1

0

不要使用-200. 它将在图像之外

 graphic.DrawRectangle(new Pen(Color.Black, LabelImage.Width), 0, 200, LabelImage.Width, y);
于 2011-03-10T23:11:52.593 回答