RichEdit控件请教

builderer 2006-09-01 03:14:48
使用了一个RichEdit控件,目的把用户输入的数据在其中显示。我现在使用的命令是:
RichEdit1->Lines->Add((*(p+i)).a);
RichEdit1->Lines->Add((*(p+i)).b);
RichEdit1->Lines->Add((*(p+i)).c);
可分别显示在了三行。我目的是要在一行输出。例如目的输出:1 2 3
怎样可以实现?
另外如果现在要改2,1、3不改动。又怎么操作?我试过了Insert、Strings都行不通。
谢谢!
...全文
253 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
FFSB 2006-09-19
  • 打赏
  • 举报
回复
用数据库会比较方便
要么只能每次清空RichEdit再用Text或Lines重加一遍
jiangshx 2006-09-19
  • 打赏
  • 举报
回复
Strings不行吗,不是这个逻辑吗?

//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
AnsiString strs[3];
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
for(int i=0;i<3;i++)strs[i]=IntToStr(i+1);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
AnsiString strtmp;
strtmp=strs[0]+" "+strs[1]+" "+strs[2];
RichEdit1->Lines->Clear();
RichEdit1->Lines->Add(strtmp);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
AnsiString strtmp;
strs[1]=5;
strtmp=strs[0]+" "+strs[1]+" "+strs[2];
RichEdit1->Lines->Strings[0]=strtmp;
}
//---------------------------------------------------------------------------
builderer 2006-09-01
  • 打赏
  • 举报
回复
假设第一行已经输出1 2 3 4 ...99 100,那么我现在要对中间的55进行修改或者在55、56之间加入一个数。怎么办?
yanhongjie 2006-09-01
  • 打赏
  • 举报
回复
不太清楚什么意思,不能把1 2 3先组织好放到个string里面然后再RichEdit1->Lines->Add一下吗?


604

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder VCL组件使用和开发
社区管理员
  • VCL组件使用和开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧