CXGRID设置Selstart和SelLength

//找到指定位置,并将文字插入Grid当前的编辑单元格中

var
   Part1, Part2 : string;
   CurrentEditor : TcxTextEdit;
begin
  CurrentEditor := TcxTextEdit(<view>.Controller.EditingController.Edit);
  if CurrentEditor <> nil then
  begin
    Part1 := Copy( CurrentEditor.Text, 1, CurrentEditor.SelStart );
    Part2 := Copy( CurrentEditor.Text, CurrentEditor.SelStart + 1, Length(CurrentEditor.Text) );
    CurrentEditor.EditValue := Part1 + TMenuitem( Sender ).Caption + Part2;
    CurrentEditor.PostEditValue;
  end;
end;

你可能感兴趣的:(length)