循环访问控件的简单例子
for i:= 1 to 10 dobegin TEdit(self.FindComponent('edit' + IntToStr(i))).Text := IntToStr(i);end;比如有10个Edit控件,自动给10个控件赋值
TRichEdit 指定内容改变颜色
procedure TFrm_PrtTest.SetColor(SelectStr: string);begin if Trim(SelectStr)<>'' then begin Memo1.SelStart := Length(Memo1.Text) - Length(SelectStr)-2; Memo1.SelLength:= Length(SelectStr); Memo1.SelAttributes.Color := clRed; end;end;...