[英]How to store Android application data/settings in RAD Studio XE6 using C++?
[英]How to draw a line under the title cells on TDBGrid using C++ in Rad Studio?
我試圖在 TDBGrid 標題單元格下畫一條線,但似乎無法讓它工作。 我在 OnDrawColumnCell 事件中這樣做:
Canvas->Pen->Color = TColor(RGB(0, 0, 0));
Canvas->MoveTo(Rect.Left, Rect.Bottom);
Canvas->LineTo(Rect.Right, Rect.Bottom);
它的簽名是這樣的:
void __fastcall TfrmModelDetails::dbGridModelMapDrawColumnCell(TObject *Sender, const TRect &Rect,
int DataCol, TColumn *Column, TGridDrawState State)
我確信在檢查調試信息后調用了該方法,但沒有繪制任何內容。 為什么會這樣?
標題單元格不調用OnDrawColumnCell
。 據我在TCustomDBGrid
源代碼中看到的,標題繪制是由一個您無法從外部更改的內部過程完成的。 可能您必須派生一個新組件並覆蓋執行所有處理的DrawCell
。
您沒有顯示dbGridModelMapDrawColumnCell
的完整代碼......請務必在其前面調用DefaultDrawColumnCell
然后進行自己的繪圖。
此外,最后一個像素線是Rect.Bottom - 1
。 你正在畫出視野。
最后, Canvas
僅指形式,而不是網格。 您必須使用您使用的DBGrid
實例進行限定,或者將Sender
參數強制轉換為TDBGrid
以引用它的Canvas
屬性。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.