[教学] Firemonkey 之 StringGrid Header 自订显示
StringGrid Header 高度设定方法:
uses FMX.Header; procedure TForm1.StringGrid1ApplyStyleLookup(Sender: TObject);
var Obj: TFmxObject;
begin
// by Aone
Obj := StringGrid1.FindStyleResource('header');
if (Obj <> nil) and (Obj is THeader) then
THeader(Obj).Size.Height := ; // 设定高度
end;
ps. 所有的 Style 都能用这个方法,找到后,再修改它。
StringGrid Header 文字颜色设定方法(不改变底色):
procedure TForm1.StringGrid1DrawColumnHeader(Sender: TObject;
const Canvas: TCanvas; const Column: TColumn; const Bounds: TRectF);
var Str: String;
begin
if Column = StringColumn1 then
begin
Str := '表头1';
Canvas.Fill.Color := claBlue;
end;
if Column = StringColumn2 then
begin
Str := '表头2';
Canvas.Fill.Color := claRed;
end; Canvas.FillText(Bounds, Str, False, , [], TTextAlign.Center, TTextAlign.Center);
end;
效果:

StringGrid Header 文字颜色设定方法(改变底色):
procedure TForm1.StringGrid1DrawColumnHeader(Sender: TObject;
const Canvas: TCanvas; const Column: TColumn; const Bounds: TRectF);
var Str: String;
BackColor, FontColor: TAlphaColor;
begin
if Column = StringColumn1 then
begin
Str := '表头1';
BackColor := claYellow;
FontColor := claBlue;
end;
if Column = StringColumn2 then
begin
Str := '表头2';
BackColor := claGold;
FontColor := claRed;
end; Canvas.Fill.Color := BackColor;
Canvas.FillRect(Bounds, , , [], );
Canvas.Fill.Color := FontColor;
Canvas.FillText(Bounds, Str, False, , [], TTextAlign.Center, TTextAlign.Center);
end;
效果:

[教学] Firemonkey 之 StringGrid Header 自订显示的更多相关文章
- header 301,显示302
header 301,显示302 一定要注意Location 后面的":"前后都不能有空格 header('HTTP/1.1 301 Moved Permanently'); he ...
- firemonkey中stringgrid属性大全
StringGrid之属性大全: Align: //确定组件在父类组件区内的对齐方式(alScale:随窗口 放大缩小) AlterRowBack ...
- [修正] Firemonkey Android 文字斜粗体显示不全的问题
问题:Firemonkey Android 平台显示斜粗体文字时,文字右方会有显示不全的问题. 修正代码: 请将 FMX.FontGlyphs.Android.pas 复制到自己的工程目录下,再修改如 ...
- [问答] Firemonkey 控件继承后无法显示(空白)
提问:如下安装后的 TMyPanel 能在设计期时正常显示,但 TMyPanel2 在设计期时是白板,不能正常看到,为什么? TMyPanel = class(TPanel) end; TMyCust ...
- [教学] Firemonkey TImageList 加入原寸图片
下面示范 Firemonkey TImageList 加入一张原始尺寸图片的方法: 使用代码加图 if Assigned(List) then begin MyList.Items.Clear; do ...
- Firemonkey 指定 StringGrid 只能上下滾动,不要左右滚动
要使 StringGrid 只能上下滚动,不要左右滚动,只要加入下面代码即可: StringGrid1.AniCalculations.TouchTracking := [ttVertical]; p ...
- StringGrid 实例5 本例功能:字体修改为居中,红色,20号
实例5 本例功能: 在FireMonkey中StringGrid对于字体的调整由于没有font属性和onDrawCell事件使得变得有些麻烦,后来费了一些功夫才找到方法.但由于XE3中某些属性还是没有 ...
- 对页面制定区域进行打印,以及打印不显示页脚URL的方法
第一种方式 - 此种方式简单易用,但不能进行页面设置,会在底部显示页面的URL地址. 打印命令:只需在页面上的按钮事件调用这段JS代码 javascript:window.print(); ===== ...
- (转载)StringGrid常用属性和常用操作
Delphi StringGrid常用属性和常用操作 StringGrid组件用于建立显示字符串的网格,与电子表格相似.它可使表格中的字符串和相关对象操作简单化.StringGrid组件提供了许多可控 ...
随机推荐
- GAMIT 10.50在Ubuntu 12.04系统下的安装
转载于:http://www.itxuexiwang.com/a/liunxjishu/2016/0225/162.html?1456480908 摘要:GAMIT/GLOBK是一套安装于Unix/L ...
- MyBatis学习总结(三)——优化MyBatis配置文件中的配置
一.连接数据库的配置单独放在一个properties文件中 之前,我们是直接将数据库的连接配置信息写在了MyBatis的conf.xml文件中,如下: 1 <?xml version=" ...
- js定时器的时间最小值-setTimeout、setInterval
HTML5标准规定 setTimeout的最短时间间隔是4毫秒: setInterval的最短间隔时间是10毫秒,也就是说,小于10毫秒的时间间隔会被调整到10毫秒 书和MDC 在John Resig ...
- Atitit.java图片图像处理attilax总结 BufferedImage extends java.awt.Image获取图像像素点image.getRGB(i, lineIndex); 图片剪辑/AtiPlatf_cms/src/com/attilax/img/imgx.javacutImage图片处理titit 判断判断一张图片是否包含另一张小图片 atitit 图片去噪算法的原理与
Atitit.java图片图像处理attilax总结 BufferedImage extends java.awt.Image 获取图像像素点 image.getRGB(i, lineIndex); ...
- 搭建LNAMP环境(五)- PHP7源码安装Redis和Redis拓展
上一篇:搭建LNAMP环境(四)- 源码安装PHP7 一.安装Redis 1.创建redis用户组和用户 groupadd redis useradd -r -g redis -s /sbin/nol ...
- springSide部署出现AnnotationConfigUtils.processCommonDefinitionAnnotations(…) is not public!
AnnotationConfigUtils.processCommonDefinitionAnnotations(…) is not public! Make sure you're using Sp ...
- Javascript学习记录——数组去重
var arr = [1, 2, 3, 5, 5, '45', '45', 4, 1, '1', '2'] for (var i = 0; i < 10000; i++) { arr.push( ...
- 关于json序列化和反序列的问题,没事写个案例,希望能帮到那些需要帮忙的朋友!
现在关于json的读写问题,有许许多多的解决方法,因人而异,根据实际问题去选择自己想要的最容易方法.我觉得自带的Newtonsoft.Json是个不错的选择,随便写两个例子吧! 一:关于简单的json ...
- Windows Server 2012部署Enterprise Solution 5.4
最近一个客户升级系统,改用Windows Server 2012作为服务器操作系统.升级之后性能未见明显的改善,在不改变代码的基础上,考虑到C/S架构的能力,增加内存或是处理器的处理能力似乎可以解决一 ...
- 关于js中值的比较规则问题
上一篇文章提到了javascript中可变值与不可变值,如果你不知道什么是可变值和不可变值,可以先去看看那篇文章,再回来看这篇,因为这篇文章是基于可变值与不可变值讲解的. 那我就默认你知道什么是可变值 ...