Преобразовать первую букву каждого слова к верхнему регистру в TEdit
Оформил: DeeCo
Автор: http://www.swissdelphicenter.ch
procedure TForm1.Edit1Change(Sender: TObject);
var
OldChange: TNotifyEvent;
OldStart: Integer;
begin
with (Sender as TEdit) do
begin
OldChange := OnChange;
OnChange := nil;
OldStart := SelStart;
if ((SelStart > 0) and (Text[SelStart - 1] = ' ')) or (SelStart = 1) then
begin
SelStart := SelStart - 1;
SelLength := 1;
SelText := AnsiUpperCase(SelText);
end;
OnChange := OldChange;
SelStart := OldStart;
end;
end;
|