檢視原始碼 wxGridCellRenderer (wx v2.4.3)
這個類別負責實際在網格中繪製儲存格。
您可以將它傳遞給 wxGridCellAttr
(如下) 來變更指定儲存格的格式,或傳遞給 wxGrid:setDefaultRenderer/2
來變更所有儲存格的檢視。這是一個抽象類別,您通常會使用其中一個預定義的衍生類別,或從它衍生您自己的類別。
請參閱
wxWidgets 文件:wxGridCellRenderer
摘要
類型
-type wxGridCellRenderer() :: wx:wx_object().
函式
-spec draw(This, Grid, Attr, Dc, Rect, Row, Col, IsSelected) -> ok when This :: wxGridCellRenderer(), Grid :: wxGrid:wxGrid(), Attr :: wxGridCellAttr:wxGridCellAttr(), Dc :: wxDC:wxDC(), Rect :: {X :: integer(), Y :: integer(), W :: integer(), H :: integer()}, Row :: integer(), Col :: integer(), IsSelected :: boolean().
使用屬性指定的樣式,以及對應於 isSelected 值的預設或選取狀態,在提供的 DC 上,於指定矩形內繪製給定的儲存格。
這個純虛擬函式有一個預設實作,會使用給定的屬性準備 DC:它會使用 attr 中的背景顏色繪製矩形,並設定文字顏色和字型。
-spec getBestSize(This, Grid, Attr, Dc, Row, Col) -> {W :: integer(), H :: integer()} when This :: wxGridCellRenderer(), Grid :: wxGrid:wxGrid(), Attr :: wxGridCellAttr:wxGridCellAttr(), Dc :: wxDC:wxDC(), Row :: integer(), Col :: integer().
取得儲存格內容的偏好大小。
這個方法必須在衍生類別中覆寫,以傳回顯示給定網格儲存格內容的最小合適大小。