全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1590
推到 Plurk!
推到 Facebook!

TFrame 上擺放的 TRichEdit(或 TntRichEdit) 無法顯示內容

答題得分者是:daldal
linly
一般會員


發表:42
回覆:37
積分:15
註冊:2007-10-07

發送簡訊給我
#1 引用回覆 回覆 發表時間:2008-04-23 12:28:48 IP:218.168.xxx.xxx 訂閱
您好:

小弟做了一個實驗,先在 TFrame 上擺放一個 TRichEdit (或 TntRichEdit),並且把 TRichEdit(或 TntRichEdit) 的 Align 設定為 clClient 填滿整塊區域,接著使用一個 Form,這個 Form 的上半部先擺一個 TRichEdit(或 TntRichEdit),下半部擺我剛剛的那個 Frame,接著在建構子執行以下兩句:

[code cpp]
this->RichEdit->Lines->LoadFromFile("測試.txt");
this->MyFrame->
RichEdit->Lines->LoadFromFile("測試.txt");
[/code]

會發生 Frame 上的那一個 RichEdit 沒有內容 (全白),而 Form 上面的 RichEdit 則正常顯示。請問一下有板友們也發生這種問題嗎?為什麼會這樣?還請指點迷津,謝謝 ^__^

PS: 那個 "測試.txt" 編碼為 Ansi(Big5),裡頭有中文 英文
daldal
高階會員


發表:6
回覆:102
積分:226
註冊:2007-06-18

發送簡訊給我
#2 引用回覆 回覆 發表時間:2008-04-23 14:16:57 IP:61.219.xxx.xxx 未訂閱


我使用 RichEdit , Frame
載入區段如下
[code cpp]
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
this->RichEdit1->Lines->LoadFromFile("測試.txt");
this->Frame21->RichEdit1->Lines->LoadFromFile("測試.txt");
}

[/code]

沒有遇到你的狀況喔...
linly
一般會員


發表:42
回覆:37
積分:15
註冊:2007-10-07

發送簡訊給我
#3 引用回覆 回覆 發表時間:2008-04-23 16:47:29 IP:218.168.xxx.xxx 訂閱
我發現問題在哪裡了。導致 Frame 上面的 RichEdit 會沒內容,而 From 上面的 RichEdit 元件內容正常顯示,是因為前者我殘留一行 code:

[code cpp]
this->MyFrame->RichEdit->DoubleBuffered = true;
[/code]

這導致了內容無法顯示出來的問題,有人知道這是為什麼嗎?

PS:會說是殘留,是因為我原本 Frame 上的元件是 TntMemo,為了拉捲軸時不讓其上的內容閃爍,所以加上去的,後來測試 RichEdit 沒有拿掉。
編輯記錄
linly 重新編輯於 2008-04-23 16:49:28, 註解 無‧
linly 重新編輯於 2008-04-23 16:50:36, 註解 有錯字,所以重新編輯‧
daldal
高階會員


發表:6
回覆:102
積分:226
註冊:2007-06-18

發送簡訊給我
#4 引用回覆 回覆 發表時間:2008-04-23 19:15:12 IP:61.219.xxx.xxx 未訂閱

Description

When DoubleBuffered is false, the windowed control paints itself directly to the window. When DoubleBuffered is true, the windowed control paints itself to an in-memory bitmap that is then used to paint the window. Double buffering reduces the amount of flicker when the control repaints, but is more memory intensive.

When a windowed control is a dock site and has an associated dock manager, it must be double-buffered.

Note: Some controls, such as TRichEdit, can't paint themselves into a bitmap. For such controls, DoubleBuffered must be set to false.
linly
一般會員


發表:42
回覆:37
積分:15
註冊:2007-10-07

發送簡訊給我
#5 引用回覆 回覆 發表時間:2008-04-23 20:29:14 IP:218.168.xxx.xxx 訂閱
Thanks a lot !!! ^________^
系統時間:2024-05-05 13:23:57
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!