2
A
回答
7
檢查此過程
procedure GenerateImageFromNumber(ANumber:Integer;Const FileName:string);
Var
Bmp : TBitmap;
begin
Bmp:=TBitmap.Create;
try
Bmp.PixelFormat:=pf24bit;
Bmp.Canvas.Font.Name :='Arial';// set the font to use
Bmp.Canvas.Font.Size :=20;//set the size of the font
Bmp.Canvas.Font.Color:=clWhite;//set the color of the text
Bmp.Width :=Bmp.Canvas.TextWidth(IntToStr(ANumber));//calculate the width of the image
Bmp.Height :=Bmp.Canvas.TextHeight(IntToStr(ANumber));//calculate the height of the image
Bmp.Canvas.Brush.Color := clBlue;//set the background
Bmp.Canvas.FillRect(Rect(0,0, Bmp.Width, Bmp.Height));//paint the background
Bmp.Canvas.TextOut(0, 0, IntToStr(ANumber));//draw the number
Bmp.SaveToFile(FileName);//save to a file
finally
Bmp.Free;
end;
end;
而且使用這樣
procedure TForm1.Button1Click(Sender: TObject);
begin
GenerateImageFromNumber(10000,'Foo.bmp');
Image1.Picture.LoadFromFile('Foo.Bmp');//Image1 is a TImage component
end;
相關問題
- 1. 德爾福7從另一個圖像的圖像限制
- 2. 德爾福:繪製行ListView
- 3. 德爾福OpenGL繪圖
- 4. 在德爾福繪製流程圖
- 5. 在德爾福7
- 6. 德爾福7 __ArrayList
- 7. 我如何加載圖像到德爾福XE8的一個apk
- 8. 德爾福v.Word - 如何從德爾福
- 9. 加載圖片到圖像德爾福
- 10. 圖像查看德爾福
- 11. 圖像處理德爾福
- 12. 顯示位圖圖像德爾福7個
- 13. 德爾福 - 如何製作圖表?
- 14. 德爾福2010年應用程序加載一個德爾福7 DLL
- 15. 德爾福7,如何將Paintbox內容複製到Tbitmap?
- 16. 德爾福7:將圖像附加到鼠標
- 17. 德爾福7和事件
- 18. 德爾福7寡婦8.1
- 19. 德爾福7繼承
- 20. 德爾福7和Windows Vista
- 21. 德爾福7 TAdoQuery太慢
- 22. 德爾福7對象undefinedat
- 23. 德爾福XE3 TStatusBar重繪
- 24. 德爾福7 - 字符集REST JSON
- 25. 更改德爾福7中的字符
- 26. 德爾福7德爾福XE2 res文件問題
- 27. 轉換德爾福7代碼與德爾福2009年工作
- 28. 翻譯代碼DLL注入德爾福7德爾福XE2
- 29. AggPas德爾福繪圖膠片
- 30. 德爾福7 - 如何將整數轉換爲字符串
我會GenerateImageFromNumber( )返回一個可以分配給TImage的TBitmap,或者直接將其繪製到TImage,而不使用臨時文件。 –
謝謝大家......! – rakesh
@rakesh,如果這解決了你的問題,那麼你應該接受RRUZ的答案。 –