如何在StringGrid控件中每格显示两行,且可以分别设置两行的颜色
来源:互联网 发布:mac怎么调输入法 编辑:程序博客网 时间:2024/05/03 02:24
procedure TForm1.Grid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var
Rect1:TRect;
Rect2:TRect;
begin
Rect1.Left:=ACol*(Rect.Right-Rect.Left)+2;
Rect1.Top:=ARow*(Rect.Bottom-Rect.Top)+2;
Rect1.Right:=Rect1.Left+(Rect.Right-Rect.Left)-2;
Rect1.Bottom:=Rect1.Top+(Rect.Bottom-Rect.Top) div 2+2;
//-----
Rect2.Left:=ACol*(Rect.Right-Rect.Left)+2;
Rect2.Top:=ARow*(Rect.Bottom-Rect.Top)+(Rect.Bottom-Rect.Top)div 2+2;
Rect1.Right:=Rect1.Left+(Rect.Right-Rect.Left)-2;
Rect1.Bottom:=Rect1.Top+(Rect.Bottom-Rect.Top)+2;
if gdSelected in state then
begin
Grid1.Canvas.Brush.Color:=clWhite;
Grid1.Canvas.TextRect(Rect1,Rect1.Left,Rect1.Top,'xxxx');
Grid1.Canvas.Brush.Color:=clWhite;
Grid1.Canvas.TextRect(Rect2,Rect2.Left,Rect2.Top,'yyyy');
end else
begin
Grid1.Canvas.Brush.Color:=clInfoBk;
Grid1.Canvas.TextRect(Rect1,Rect1.Left,Rect1.Top,'xxxx');
Grid1.Canvas.Brush.Color:=clLime;
Grid1.Canvas.TextRect(Rect2,Rect2.Left,Rect2.Top,'yyyy');
end;
end;
Rect: TRect; State: TGridDrawState);
var
Rect1:TRect;
Rect2:TRect;
begin
Rect1.Left:=ACol*(Rect.Right-Rect.Left)+2;
Rect1.Top:=ARow*(Rect.Bottom-Rect.Top)+2;
Rect1.Right:=Rect1.Left+(Rect.Right-Rect.Left)-2;
Rect1.Bottom:=Rect1.Top+(Rect.Bottom-Rect.Top) div 2+2;
//-----
Rect2.Left:=ACol*(Rect.Right-Rect.Left)+2;
Rect2.Top:=ARow*(Rect.Bottom-Rect.Top)+(Rect.Bottom-Rect.Top)div 2+2;
Rect1.Right:=Rect1.Left+(Rect.Right-Rect.Left)-2;
Rect1.Bottom:=Rect1.Top+(Rect.Bottom-Rect.Top)+2;
if gdSelected in state then
begin
Grid1.Canvas.Brush.Color:=clWhite;
Grid1.Canvas.TextRect(Rect1,Rect1.Left,Rect1.Top,'xxxx');
Grid1.Canvas.Brush.Color:=clWhite;
Grid1.Canvas.TextRect(Rect2,Rect2.Left,Rect2.Top,'yyyy');
end else
begin
Grid1.Canvas.Brush.Color:=clInfoBk;
Grid1.Canvas.TextRect(Rect1,Rect1.Left,Rect1.Top,'xxxx');
Grid1.Canvas.Brush.Color:=clLime;
Grid1.Canvas.TextRect(Rect2,Rect2.Left,Rect2.Top,'yyyy');
end;
end;
- 如何在StringGrid控件中每格显示两行,且可以分别设置两行的颜色
- 在vc++中调用Excel,怎样设置单元格的格式可以得到科学计数法显示,且保留两位小数
- 两种设置控件背景颜色的方法
- 在word中插入显示在同一行的两张图片(且各自带有题注)
- 在word中插入显示在同一行的两张图片(且各自带有题注)
- 如何在一DataGrdiViewColumn中中显示两行内容,或者多行内容
- RDLC 设置表的重复标题行(在每页中显示标题行)
- RDLC 设置表的重复标题行(在每页中显示标题行)
- RDLC 设置表的重复标题行(在每页中显示标题行)
- RDLC 设置表的重复标题行(在每页中显示标题行)
- Android 开发中使用的颜色可以分为两种,自定义颜色和系统颜色
- 每页显示两条
- MATLAB如何在同一窗口中显示两幅图片
- 如何动态设置ExtJS Form控件文字显示的颜色
- Delphi中对TRichEdit控件的每一行设置不同的颜色
- 让ListBox控件每一行显示不同的颜色
- 13-1盒模型代码简写关于颜色的css样式也是可以缩写的,当你设置的颜色是16进制的色彩值时,如果每两位的值相同,可以缩写一半。 例子1: p{color:#000000;} 可以缩写为: p{
- Launcher 中 图标的名字显示为两行
- Transact SQL 常用语句以及函数
- 求表中几个列中最小值与最大值
- 数据库设计范式深入浅出
- 关于微软MSN照片上传组件MsnPhotoUpload
- 电子地图与纸张地图的比较
- 如何在StringGrid控件中每格显示两行,且可以分别设置两行的颜色
- 中国应当复仇
- 运动会的风采
- 细线表格制作
- 愚人节快乐!
- 互联网电子邮件服务管理办法
- javascript技巧参考
- javascript控制页面控件隐藏显示的两种方法
- asp.net中窗口相关操作总结(javascript)