200分求:delphi如何实现《新概念英语句霸》的这个类似功能!

来源:百度知道 编辑:UC知道 时间:2024/07/02 08:29:19
《新概念英语句霸》的这项功能是:打开界面,缺省显示某篇课文的英语文本,一句一行;点击checkbox(caption显示中文)勾选,则每一句(行)英语文本下面显示颜色不同的对应中文译文;再点checkbox(caption取消中文)取消勾选,对应的中文译文消失,恢复原界面。
我这里要求点击checkbox后在中文文本的每个自然段(注意是自然段!)下同样
显示对应于该自然段的相关文本;并像句霸一样再点checkbox,各自然段下的相关文本消失,界面恢复原貌。
祈求高手帮忙。外行勿扰,勿扰!!
不要胡乱灌水!!请求针对性的答案!

翻译是自己搞定吧?
你可以使用Memo来显示你的翻译文字和译文。译文需要以一个标识符开头,一个标识符结束。
比如:<%>...译文...</%>
我已经帮你搞好啦。(自己问了人的,我开始没弄好。。)
interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,StrUtils;

type
TForm1 = class(TForm)
Memo1: TMemo;
CheckBox1: TCheckBox;
procedure CheckBox1Click(Sender: TObject);
procedure addText(Boolean : Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.addText(Boolean: Boolean);
var
i,Strl,EndL : integer;
s : string;
str1,str2,StrText : TStringList;
begin
try
Str1 := TStringList.Create;
Str2 := TStringList.Create;
StrText := TStringList.Create;
s :='<i> this is add Textthis is