社区
C++ Builder
帖子详情
求教关于捕获StringGrid刷新的问题,在线解决就给分:200分
iec
2003-10-16 07:00:36
在Form上放StringGrid
StringGrid1->Canvas->TextOutA(left,top,"刷新");
如果最小化Form,再最大化Form ,StringGrid1已经被刷新了
开始写上的文字就没了
如何捕获StringGrid刷新的消息,使之不用刷新?
...全文
44
10
打赏
收藏
求教关于捕获StringGrid刷新的问题,在线解决就给分:200分
在Form上放StringGrid StringGrid1->Canvas->TextOutA(left,top,"刷新"); 如果最小化Form,再最大化Form ,StringGrid1已经被刷新了 开始写上的文字就没了 如何捕获StringGrid刷新的消息,使之不用刷新?
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
10 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
yjy1001
2003-10-21
打赏
举报
回复
把 canvas上要画的字写成函数
在form的OnResize里 重新调用你的写canvas函数 就可以了
例如:
form的OnResize中:
StringGrid1->Canvas->TextOutA(left,top,"刷新");
就可以了
iec
2003-10-18
打赏
举报
回复
我需要在StringGrid上显示不同颜色的字,用Cells则不能显示
ezhoulu
2003-10-18
打赏
举报
回复
下面的代码可解决的实际问题
void __fastcall TMainForm::DG_TimePlayDrawCell(TObject *Sender, int ACol,
int ARow, TRect &Rect, TGridDrawState State)
{
int valX, valY;
String valStr;
if(ARow==0)
{
valStr=ProgramTitle[ACol];
}
else
{
if(ARow-1==2)
this->DG_TimePlay->Canvas->Font->Color = clRed;
if(ARow-1==3)
this->DG_TimePlay->Canvas->Font->Color = clFuchsia;
switch(ACol)
{
case 0:
valStr = IntToStr(ARow);
break;
case 1:
valStr = PA[ARow-1].JM_name;
break;
case 2:
valStr = PA[ARow-1].JM_length;
break;
case 3:
valStr = PA[ARow-1].JM_mustattrib;
break;
case 4:
valStr = PA[ARow-1].JM_maker;
break;
case 5:
valStr = PA[ARow-1].JM_loop;
break;
case 6:
valStr = PA[ARow-1].JM_filename;
break;
}
}
valX =((Rect.Left + Rect.Right) - this->DG_TimePlay->Canvas->TextWidth(valStr)) /2;
valY =((Rect.Top + Rect.Bottom) - this->DG_TimePlay->Canvas->TextHeight(valStr)) / 2;
this->DG_TimePlay->Canvas->TextOutA(valX, valY, valStr);
}
sfemil
2003-10-17
打赏
举报
回复
你为什么不直接在StringGrid的Cells中写信息,这样信息不需要刷新时维护。
Canvas只是他的画布,只负责显示图象,本身不保存图象信息,所以刷新时 原由信息会被擦除。
你可以考虑使用TStringGrid的OnDrawCell事件 将代码放在这里处理,这样就能达到你要的效果。
ljianq
2003-10-17
打赏
举报
回复
在Form的OnPaint事件中,再调用一次StringGrid1->Canvas->TextOutA(left,top,"刷新");
domustdo
2003-10-16
打赏
举报
回复
为什么要在StringGrid的canvas上写字?
iec
2003-10-16
打赏
举报
回复
这样的因为我已经在StringGrid1上写上很多数据了,如果用Form的OnPaint事件的话,数据还要重写一遍,麻烦,有没有不让StringGrid1刷新,不重写, songhtao(三十年孤独) 能说得详细点吗?
klbt
2003-10-16
打赏
举报
回复
同意楼上
我不懂电脑
2003-10-16
打赏
举报
回复
可以用Form的OnPaint事件呀。
yjy1001
2003-10-16
打赏
举报
回复
捕获form刷新
然后在form刷新后 你再——StringGrid1->Canvas->TextOutA(left,top,"刷新");
textout一次 不就可以了吗?
Delphi将
String
grid
指定行添加到Memo控件中.rar
Delphi将
String
grid
指定行添加到Memo控件中,选中
String
Grid
中的行,点击右下角的“添加”按钮,即可将选中的
String
Grid
行数据添加到下边的Memo控件中显示。部
分
源代码如下: procedure TForm1.FormCreate(Sender: TObject); begin
String
Grid
1.Cells[0,0] := '商品编号';
String
Grid
1.Cells[0,1] := 'cc10011';
String
Grid
1.Cells[0,2] := 'cc10012';
String
Grid
1.Cells[0,3] := 'cc10013';
String
Grid
1.Cells[0,4] := 'cc10014';
String
Grid
1.Cells[1,0] := '商品名称';
String
Grid
1.Cells[1,1] := '苹果';
String
Grid
1.Cells[1,2] := '香蕉';
String
Grid
1.Cells[1,3] := '西红柿';
String
Grid
1.Cells[1,4] := '西瓜';
String
Grid
1.Cells[2,0] := '商品数量';
String
Grid
1.Cells[2,1] := '
200
';
String
Grid
1.Cells[2,2] := '150';
String
Grid
1.Cells[2,3] := '300';
String
Grid
1.Cells[2,4] := '130';
String
Grid
1.Cells[3,0] := '商品金额';
String
Grid
1.Cells[3,1] := '$5.00';
String
Grid
1.Cells[3,2] := '$4.50';
String
Grid
1.Cells[3,3] := '$1.50';
String
Grid
1.Cells[3,4] := '$6.00'; end; procedure TForm1.Button1Click(Sender: TObject); var i,col,row: Integer; begin row :=
String
Grid
1.Row; for col := 0 to
String
Grid
1.ColCount - 1 do Memo1.Lines.Add(
String
Grid
1.Cells[col,row]); end;
给
String
Grid
添加组合框
这是给
String
Grid
的某一列添加组合框的完整示例。 不过这里的
String
Grid
是raize控件包的,自带的
String
Grid
也是可以用的,只需要替换一下控件和改一下控件的名字。
关于
string
grid
写的一个小程序,操作
string
grid
的.
String
Grid
DB
Grid
全书
详细讲解
String
Grid
DB
Grid
用法,有delphi源码
string
grid
多选拖拽换行
使用
string
grid
实现行多选, 然后通过拖拽移动选择行位置 按住ctrl可以多选不连续的行
C++ Builder
13,826
社区成员
102,678
社区内容
发帖
与我相关
我的任务
C++ Builder
C++ Builder相关内容讨论区
复制链接
扫一扫
分享
社区描述
C++ Builder相关内容讨论区
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章