1.比如一個單元格內,圖片在上面,其下方是圖片名,最重要一點的是,同時要求該單元格的高度能自動調整。如何實作,求高手幫忙。
uj5u.com熱心網友回復:
一個單元格里顯示兩個元素,只能自畫了自動適應除錯,可以在OnGetCellHeight事件中自己計算
uj5u.com熱心網友回復:
怎么貌似我在cb版見過類似的帖子
圖片下面畫好文字,再把圖片畫到單元格里,自適應高度按LS說的
uj5u.com熱心網友回復:
單元格高度自動調整可以設定tvcxgrd1DBTableView1.OptionsView.CellAutoHeight:=True
圖片話設定cxgrdbclmntvcxgrd1DBTableView1.Properties的屬性為Image
文字顯示 自己畫把
uj5u.com熱心網友回復:
想知道自畫以外的方法,因為個別自畫的文本還希望它能接收點擊事件,這樣的自畫就會很羅嗦,想知道有沒有更簡單的方法,感覺這么強大的組件應該有更簡單的操作,而不是全靠自畫。
cb用的人越來越少,所以兩個版面都問問
uj5u.com熱心網友回復:
有沒有熟悉devexpress的 cxgrid,來指導一下。uj5u.com熱心網友回復:
procedure TForm1.tvGrid1DBTableView1CustomDrawCell(
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
var
AEditValue: Variant;
APicture: TPicture;
FBounds:TRect;
begin
cxgrdbclmnGrid1DBTableView1IconImage.Options.Focusing:=False; //點上去圖示不變
if AViewInfo.Item <> cxgrdbclmnGrid1DBTableView1IconImage then
begin
Exit;
end;
AEditValue := AViewInfo.GridRecord.Values[cxgrdbclmnGrid1DBTableView1IconImage.Index];
if VarIsStr(AEditValue) or VarIsArray(AEditValue) then
begin
APicture := TPicture.Create;
try
LoadPicture(APicture,
TcxImageProperties(cxgrdbclmnGrid1DBTableView1IconImage.Properties).GraphicClass, AEditValue);
APicture.Bitmap.Canvas.Brush.Style:=bsClear;
APicture.Bitmap.Canvas.TextOut(10,40,AViewInfo.GridRecord.Values[cxgrdbclmnGrid1DBTableView1CName.Index]); //文本顯示的位置 自己根據需要調整把
FBounds:=AViewInfo.Bounds;
ACanvas.FillRect(FBounds);
ACanvas.DrawComplexFrame(FBounds, clBtnHighlight, clBtnShadow, [bBottom, bLeft, bRight], 1);
InflateRect(FBounds, -1, -1);
ACanvas.Font.Color := clBlack;
ACanvas.Brush.Style := bsClear;
ACanvas.DrawGlyph(FBounds.Left,FBounds.Top,APicture.Bitmap);
finally
APicture.Free;
end;
end;
ADone:=True;
end;
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/130928.html
標籤:VCL組件開發及應用
上一篇:delphi相關問題
下一篇:演算法導論
