作者one164 (阿MON)
看板C_Sharp
標題[問題] 應該算是圖檔的小問題
時間Wed Sep 9 05:06:40 2009
小弟最近寫程式遇到了一個瓶頸
找很多網站也不知道該怎麼解決
以下是小弟目前的程式片段
private void CreateCheckCodeImage(string checkCode)
{
if (checkCode == null || checkCode.Trim() == String.Empty)
return;
System.Drawing.Bitmap image = new
System.Drawing.Bitmap((int)Math.Ceiling((checkCode.Length * 15)), 20);
Graphics g = Graphics.FromImage(image);
問題在第六行的Math.Ceiling((checkCode.Length * 15)), 20);
這裡執行時會出現以下這個錯誤
在下列方法或屬性之間的呼叫模稜兩可: 'System.Math.Ceiling(decimal)' 和
System.Math.Ceiling(double)
我研究很久也不知道該改哪邊
小弟在猜想可能是int和Ceiling起衝突
可是不知道該怎麼做
有版上大大能指導一下小弟嗎? 感激不盡!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.44.8.121
1F:推 hamsters:checkCode.Length * 15 一定是整數,不用取 Ceiling 吧 09/09 08:04
2F:→ one164:喔喔 我看vs解說 我以為那是要用來傳回值 09/09 10:59
3F:→ one164:感謝h大! 09/09 10:59