線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:2027
推到 Plurk!
推到 Facebook!

請教 Tchart如何轉成 圖檔 再存到table內??

尚未結案
seedbcc
高階會員


發表:232
回覆:272
積分:105
註冊:2003-12-10

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-01-20 23:46:47 IP:211.76.xxx.xxx 未訂閱
請教 Tchart如何轉成 圖檔 再存到table內?? ?? Pic:tbimmap; pic:= chart1.?? table1.fieldbyname('picture').as???? 是什麼形態?
shinjie
資深會員


發表:12
回覆:275
積分:287
註冊:2003-03-19

發送簡訊給我
#2 引用回覆 回覆 發表時間:2005-01-21 08:00:48 IP:203.73.xxx.xxx 未訂閱
1、直接用TChart的存圖檔 Chart1.SaveToBitmapFile('路徑\圖表檔1.bmp'); 2、用TBlobField TBlobField(Table1.FieldByName('Picture')).LoadFromFile('檔案路徑');
------
我將在茫茫人海中尋訪我唯一之靈魂伴侶。
得之;我幸。不得;我命。
seedbcc
高階會員


發表:232
回覆:272
積分:105
註冊:2003-12-10

發送簡訊給我
#3 引用回覆 回覆 發表時間:2005-01-21 09:04:56 IP:221.169.xxx.xxx 未訂閱
?? shinjie 大大 我想要的方法是 將form上面的Tchart轉成圖檔 然後寫入暫存的Table 因為,form上面的圖檔數量 是動態產生 不確定多少 最終是要傳到 列印的報表 form 如此才能 依據資料表的記錄數量 連結 Tqrdbimage來列印
shinjie
資深會員


發表:12
回覆:275
積分:287
註冊:2003-03-19

發送簡訊給我
#4 引用回覆 回覆 發表時間:2005-01-21 10:24:29 IP:203.73.xxx.xxx 未訂閱
我有寫一個測式程式 請參考看看 新增一筆資料就可以看到結果了。 http://delphi.ktop.com.tw/topic.php?TOPIC_ID=63924
------
我將在茫茫人海中尋訪我唯一之靈魂伴侶。
得之;我幸。不得;我命。
seedbcc
高階會員


發表:232
回覆:272
積分:105
註冊:2003-12-10

發送簡訊給我
#5 引用回覆 回覆 發表時間:2005-01-21 11:10:22 IP:221.169.xxx.xxx 未訂閱
還是不太懂?? Chart1.SaveToBitmapFile('路徑\圖表檔1.bmp'); ---------------- 這不是由 磁碟機載入嗎 ?? 我是 要由form上面的tchart塞給一個暫存的變數圖檔 然後才寫入record內的欄位
seedbcc
高階會員


發表:232
回覆:272
積分:105
註冊:2003-12-10

發送簡訊給我
#6 引用回覆 回覆 發表時間:2005-01-21 11:18:43 IP:221.169.xxx.xxx 未訂閱
可否不save到磁碟 就可以完成動作
shinjie
資深會員


發表:12
回覆:275
積分:287
註冊:2003-03-19

發送簡訊給我
#7 引用回覆 回覆 發表時間:2005-01-21 11:21:59 IP:203.73.xxx.xxx 未訂閱
我只知道TChart的這個方式將圖表存出來,如果不能符合你的需求,那你可能要找別的控件,或是自已改寫TChart了。
------
我將在茫茫人海中尋訪我唯一之靈魂伴侶。
得之;我幸。不得;我命。
jamests
初階會員


發表:0
回覆:43
積分:28
註冊:2005-01-21

發送簡訊給我
#8 引用回覆 回覆 發表時間:2005-01-21 15:04:33 IP:211.75.xxx.xxx 未訂閱
您好: TChart似乎只能將圖存成檔案. 沒有SaveToStream的功能. 所以我的做法是用ScreenShot... 只把TChart的範圍抓下來成TBitmap 之後看要SaveToFile或是SaveTo TBlobField都可以. ps. 當然要該TChart是可視的(Visible)才有效. 不知是否符合您的需求. 供參考.
StrongLemon
高階會員


發表:10
回覆:166
積分:105
註冊:2004-04-18

發送簡訊給我
#9 引用回覆 回覆 發表時間:2005-01-21 15:44:32 IP:221.169.xxx.xxx 未訂閱
您好:請參考TeeChart的儲存用函式
{*********************************************}
{  TeeChart Storage functions                 }
{  Copyright (c) 1997-2004 by David Berneda   }
{  All rights reserved                        }
{*********************************************}
unit TeeStore;    { Read a Chart from a file (example: Chart1,'c:\demo.tee' ) }
Procedure LoadChartFromFile(Var AChart:TCustomChart; Const AFileName:String);    { Write a Chart to a file (example: Chart1,'c:\demo.tee' ) }
Procedure SaveChartToFile(AChart:TCustomChart; Const AFileName:String;
                          IncludeData:Boolean=True;
                          TextFormat:Boolean=False);    { The same using TStream components (good for BLOB fields, etc)  }
Procedure LoadChartFromStream(Var AChart:TCustomChart; AStream:TStream);    Procedure SaveChartToStream(AChart:TCustomChart; AStream:TStream;
                            IncludeData:Boolean=True;
                            TextFormat:Boolean=False);    { (Advanced) Read charts and check for errors  }
{ return True if ok, False to stop loading }
type TProcTeeCheckError=function(const Message: string): Boolean of object;    Procedure LoadChartFromStreamCheck( Var AChart:TCustomChart;
                                    AStream:TStream;
                                    ACheckError:TProcTeeCheckError=nil;                                        // For compatibility with version 5 saved
                                    // charts.
                                    // Pass FALSE to skip past-reading
                                    TryReadData:Boolean=True  // 6.01
                               );    Procedure LoadChartFromFileCheck( Var AChart:TCustomChart;
                                  Const AName:String;
                                  ACheckError:TProcTeeCheckError
                                  );    // Convert a binary *.tee file to text format
Procedure ConvertTeeFileToText(Const InputFile,OutputFile:String);    // Convert a text *.tee file to binary format
Procedure ConvertTeeFileToBinary(Const InputFile,OutputFile:String);
Fishman
尊榮會員


發表:120
回覆:1949
積分:2163
註冊:2006-10-28

發送簡訊給我
#10 引用回覆 回覆 發表時間:2005-01-21 15:56:02 IP:210.65.xxx.xxx 未訂閱
Hi seedbcc,    1.坦白講,把 BitMap 存進 DataBase 只是為了列印,實在有點‧‧‧ 但若是有其他功用,那又另當別論,請參考 < href="http://delphi.ktop.com.tw/topic.php?TOPIC_ID=61965">http://delphi.ktop.com.tw/topic.php?TOPIC_ID=61965 http://delphi.ktop.com.tw/topic.php?topic_id=61968
var
  PIC : TBitMap;
begin
  Inc(CurrentPage);
  MoreData := (CurrentPage <= TotalPage);
  if MoreData then
    begin
      Chart1.Page := CurrentPage;
      Pic := Chart1.TeeCreateBitmap(clWhite,Chart1.ClientRect);
      try
        QRImage1.Picture.Bitmap.Assign(PIC);
      finally
        PIC.Free;
      end;
    end;
end;
2.請參考 http://delphi.ktop.com.tw/topic.php?topic_id=19505 http://delphi.ktop.com.tw/topic.php?topic_id=55073 3.如果只是為了列印,我會這樣作 http://delphi.ktop.com.tw/loadfile.php?TOPICID=20015111&CC=447629 ---------------------------------- 小弟才疏學淺,若有謬誤尚請不吝指教 ----------------------------------
------
Fishman
系統時間:2024-09-08 3:28:17
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!