向各位请教一个关于TMS Grids问题!(如有时间麻烦给我指点一二) 我想请问一下,AdvStringGrid 这个控件,我要设置某一单元格的颜色应该怎么设置。比如说我在在表格的单击事件中,去触发该事件,将当前单元的颜色改为某一种颜色。(可能表达的不是很清楚,望见谅)在此先谢谢了! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 TStringGrid都有相应的事件。在OnDrawCell里写代码。type TDrawCellEvent = procedure (Sender: TObject; ACol, ARow: Longint; Rect: TRect; State: TGridDrawState) of object;property OnDrawCell: TDrawCellEvent;在代码中判断state (TGridDrawState = set of (gdSelected, gdFocused, gdFixed) ),如果gdSelect in state 则改变颜色,否则将颜色置为默认值就可以了。 我想问一下如果我不放OnDrawCell事件中该如何去改变某一单元格的颜色,不知道行不行。 给你一个代码例子,自己参考procedure TFrmOut.aGridGetCellColor(Sender: TObject; ARow, ACol: Integer; AState: TGridDrawState; ABrush: TBrush; AFont: TFont);begin if (StrToIntdef(agrid.Cells[18,arow],6) = 0) then AFont.Style := [fsBold];end; 问题来了,请大有指点. 寻求高质量图形缩小算法,急救!!1 ATT AT< Group 4位图文件 用什么软件打开? 100分啊 关于QRDBText 状态条中如何显示图标? 请教“笑三少”? 怎样取得操作系统本身的语言? 请教大虾:单位刚装了ISDN,准备通过一台服务器让我们这个局域网共享上网(用PROXY作代理工具),现在共享上网作到了,但是蚂蚁和QQ都用不成了,该怎么设置??? 关于安装程序的设计(50分) 如何判断一个光标位置: 请教在Access中如何用SQL语句修改表名? Borland.com上注册会员要钱吗?
在OnDrawCell里写代码。
type
TDrawCellEvent = procedure (Sender: TObject; ACol, ARow: Longint; Rect: TRect; State: TGridDrawState) of object;
property OnDrawCell: TDrawCellEvent;在代码中判断state (TGridDrawState = set of (gdSelected, gdFocused, gdFixed) ),如果gdSelect in state 则改变颜色,否则将颜色置为默认值就可以了。
procedure TFrmOut.aGridGetCellColor(Sender: TObject; ARow, ACol: Integer;
AState: TGridDrawState; ABrush: TBrush; AFont: TFont);
begin
if (StrToIntdef(agrid.Cells[18,arow],6) = 0) then
AFont.Style := [fsBold];
end;