first:
dbrichedit.autodisplay:=false;dbrichedit.wantreturn:=false;
code:
procedure TForm1.DBRichEdit1Change(Sender: TObject);
begin
if DBRichEdit1.CaretPos.y mod 2 =0 then
DBRichEdit1.Undo;//奇数行不可修改
end;
procedure TForm1.Table1AfterScroll(DataSet: TDataSet);
var i:Integer;
begin
DBRichEdit1.LoadMemo;
//手工装入该字段
with TCustomMemo(DBRichEdit1)do
begin
for i:=1 to round(lines.Count/2)do
Lines.Delete(i);
//先删除偶数行
for i:=1 to Lines.Count*2-1do
if i mod 2=1 then
Lines.Insert(I,chr(13));
//再加入空行
end;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
Database1.StartTransaction;
end;
procedure TForm1.FormHide(Sender: TObject);
begin
Database1.Rollback;
end;
//以上两个过程用来保证每次在偶数行的输入和加入的空行不存入库中
//不知你做这个东西有什么用呢?