2011-03-10 39 views
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; 

} 
+0

如果您發佈編譯的代碼會更容易。 – 2011-03-10 23:09:29

回答

0

不要使用-200。它將在圖像之外

graphic.DrawRectangle(new Pen(Color.Black, LabelImage.Width), 0, 200, LabelImage.Width, y);