表格中要求看不到任何线条,但是又不能影响对列的动态属性设置
解决方案 »
- 请高手帮帮小弟,公司要求3天内掌握delphi,说可能吗?来者有分.
- 关于TreeView中更改Text和Image的问题
- 怎样在BDS2006中安装DevExpress.ExpressQuantumGrid.Suite.v5.17?
- 我想编写一个腾讯通的机器人,不知道该从哪里下手,请高手指教,谢谢!
- 简单的RzProgressBar1问题,在线等!!
- mssql+bde 怎么打包??难道要把sqlserver的客户端也要装上去吗??
- 我想了解‘Bug 列表‘是怎么回事,最好有例子
- 急!急!急!向各位高手请教:
- 关于Tstringgrid的多行选择问题!!
- 如何调用已经编译成功的EXE程序?
- element ui 合计行
- delphi7+indy9, 写的http服务,收到两个同时的http请求后,无应答,如何解决。
procedure TForm1.cxGrid1BandedTableView1CustomDrawColumnHeader(
Sender: TcxGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxGridColumnHeaderViewInfo; var ADone: Boolean);
begin
DrawBandHeader(Sender, ACanvas, AViewInfo, ADone);
end;procedure TForm1.DrawBandHeader(Sender: TObject; ACanvas: TcxCanvas;
AViewInfo: TcxCustomGridViewCellViewInfo; var ADone: Boolean);
const
MultiLines : array[Boolean] of Integer = (cxSingleLine, cxWordBreak);
ShowEndEllipsises : array[Boolean] of Integer = (0, cxShowEndEllipsis);
var
ATextRect, ABounds: TRect;
AFontTextColor, ABkColor: TColor;
ABorders : TcxBorders;
AText : string;
AFont : TFont;
isBand : Boolean;
begin ABkColor := 0;
ABounds := AViewInfo.Bounds;
ABorders := [bTop, bBottom, bLeft, bRight];
AFont := ACanvas.Font;
ATextRect := AViewInfo.ContentBounds;
AFontTextColor := ACanvas.Font.Color;
InflateRect(ATextRect, -1, -1);
isBand := False;
if AViewInfo.ClassName = 'TcxGridBandHeaderViewInfo' then
isBand := True; //设置颜色及鼠标移上、按下效果
case AViewInfo.ButtonState of
cxbsDefault, cxbsNormal, cxbsDisabled:
ABkColor := clwhite;
cxbsHot:
ABkColor := $00FAE4DC;
cxbsPressed:
ABkColor := $908782;
end; if not isBand then
begin
AText := TcxGridColumnHeaderViewInfo(AViewInfo).Column.Caption //列标题
end
else
AText := TcxGridBandHeaderViewInfo(AViewInfo).Band.Caption; with ACanvas do
begin
//填充标题颜色
if (ABkColor <> clNone) then
begin
SetBrushColor(ABkColor);
FillRect(ABounds);
end;
//
if AText <> '' then
begin
Brush.Style := bsClear;
Font := AFont;
Font.Color := AFontTextColor;
DrawText(AText, ATextRect, cxAlignmentsHorz[taCenter] or cxAlignmentsVert[vaCenter] or MultiLines[False] or ShowEndEllipsises[False]);
Brush.Style := bsSolid;
end;
end; with ABounds do
begin
// 这里是加边框
ACanvas.Brush.Color := $908782;
if (not isBand) and (TcxGridColumnHeaderViewInfo(AViewInfo).Index = 0) then
if bLeft in ABorders then // 左边框
ACanvas.FillRect(Rect(Left, Top, Left, Bottom));
if isBand then
begin
if bTop in ABorders then //上边框
ACanvas.FillRect(Rect(Left, Top, Right, Top));
if bRight in ABorders then //右边框
ACanvas.FillRect(Rect(Right, Top, Right, Bottom));
if bBottom in ABorders then //下边框
ACanvas.FillRect(Rect(Left, Bottom, Right, Bottom));
end;
end;
ADone := True;end;