两个问题
2006-04-24 18:49
190 查看
我怎么改变StringGrid->Cell[i][j]中字体的颜色啊?
我只要改变字体的颜色就可以了
还有就是StringGrid最左边一列和最上面一行的颜色太难看的,有什么属性可以换掉这颜色啊?
第一个问题用重画吧。
代码如下:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
for (int i = 0;i < StringGrid1->ColCount;i ++)
for (int j = 0;j < StringGrid1->RowCount;j ++)
StringGrid1->Cells[j][i] = IntToStr(j) + "," + IntToStr(i);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::StringGrid1DrawCell(TObject *Sender, int ACol,
int ARow, TRect &Rect, TGridDrawState State)
{
StringGrid1->Canvas->Brush->Color = clWhite;
StringGrid1->Canvas->FillRect(Rect);
if (ACol == 3 && ARow == 3)
StringGrid1->Canvas->Font->Color = clRed;
else
StringGrid1->Canvas->Font->Color = clBlack;
StringGrid1->Canvas->TextOutA(Rect.Left + 2,Rect.Top + 2,StringGrid1->Cells[ARow][ACol]);
}
//---------------------------------------------------------------------------
第二个问题,如果你想改变颜色的话,可以设置StringGrid的FixedColor即可。
我只要改变字体的颜色就可以了
还有就是StringGrid最左边一列和最上面一行的颜色太难看的,有什么属性可以换掉这颜色啊?
第一个问题用重画吧。
代码如下:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
for (int i = 0;i < StringGrid1->ColCount;i ++)
for (int j = 0;j < StringGrid1->RowCount;j ++)
StringGrid1->Cells[j][i] = IntToStr(j) + "," + IntToStr(i);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::StringGrid1DrawCell(TObject *Sender, int ACol,
int ARow, TRect &Rect, TGridDrawState State)
{
StringGrid1->Canvas->Brush->Color = clWhite;
StringGrid1->Canvas->FillRect(Rect);
if (ACol == 3 && ARow == 3)
StringGrid1->Canvas->Font->Color = clRed;
else
StringGrid1->Canvas->Font->Color = clBlack;
StringGrid1->Canvas->TextOutA(Rect.Left + 2,Rect.Top + 2,StringGrid1->Cells[ARow][ACol]);
}
//---------------------------------------------------------------------------
第二个问题,如果你想改变颜色的话,可以设置StringGrid的FixedColor即可。
相关文章推荐
- 记录两个python的小问题
- 重复子串问题(四):求两个字符串的最长公共字串
- 关于c#中两个DataGrid绑定到主表和子表的数据同步问题
- 提交表单,有两个页面,一个是系统日志,一个是运行日志,其中日志类型不能用同一个"name",否则其中一个会出现404页面,可能是缓存问题吧(API?)
- 最长公共子序列LCS 与最长公共子串 两个问题的动态规化 解法
- 编程求解,输入两个整数n和m,从数列1,2,3,……n中随意取几个数,使其和等于m。要求将所有的可能组合列出来(背包问题求解)
- 两个问题的对比
- 数据处理的两个基本问题(学习汇编)
- CI框架部署遇到的两个问题
- 开发中“错误: 意外地调用了方法或属性访问。” 和 第一行错误 的IE 两个问题( JQ 进行转义字符 , 分页JS 调用 时参数问题。)
- 一个页面两个session的问题分析
- Unicode字符集就是为了解决字符集这种不兼容的问题而产生的,它所有的字符都用两个字节表示,即英文字符也是用两个字节表示
- 解决问题--VS2012中一个Panel覆盖另一个Panel时拖动时容易造成两个控件成父子关系的避免
- Spark连接不同的两个服务器时的联系人列表的问题
- ERROR Error when sending message to topic test_topic with key: null, value: 3 bytes……:部署Kafka时遇到两个问题
- 详谈fastjson将对象格式化成json时的两个问题
- 今晚参加拓科工作室的笔试两个很尴尬的问题
- Python两个进程沟通问题
- 对于biee 两个页面提示默认值出现错误的小问题
- 安装Rational Rose Enterprise Edition 2003中的两个问题