Вниз
Скачать: CL | DM;

Tmemo   Найти похожие ветки 

 
Itonix ©   (2006-08-26 00:28) [0]

задача:
если навести мышкой на ТМемо , то необходимо узнать какое слово находиться под ним?


 
batya17 ©   (2006-08-26 01:04) [1]

В memo незнаю, ненашел а вот в richedit
uses
RichEdit;
 
procedure TForm1.RichEdit1MouseMove(Sender: TObject; Shift: TShiftState;
 X, Y: Integer);
var
 iCharIndex, iLineIndex, iCharOffset, i, j: Integer;
 Pt: TPoint;
 s: string;
begin
 with TRichEdit(Sender) do
 begin
   Pt := Point(X, Y);
   // Get Character Index from word under the cursor
   iCharIndex := Perform(Messages.EM_CHARFROMPOS, 0, Integer(@Pt));
   if iCharIndex < 0 then Exit;
   // Get line Index
   iLineIndex  := Perform(EM_EXLINEFROMCHAR, 0, iCharIndex);
   iCharOffset := iCharIndex - Perform(EM_LINEINDEX, iLineIndex, 0);
   if Lines.Count - 1 < iLineIndex then Exit;
   // store the current line in a variable
   s := Lines[iLineIndex];
   // Search the beginning of the word
   i := iCharOffset + 1;
   while (i > 0) and (s[i] <> " ") do Dec(i);
   // Search the end of the word
   j := iCharOffset + 1;
   while (j <= Length(s)) and (s[j] <> " ") do Inc(j);
   // Display Text under Cursor
   Caption := Copy(s, i, j - i);
 end;
end;



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.031 c
1-1155025352
SamProf
2006-08-08 12:22
2006.09.17
Как открыть свойства файла на ftp


2-1156567266
Pupkin
2006-08-26 08:41
2006.09.17
Ошибка "List index out of bounds"


2-1155816839
.ruslan
2006-08-17 16:13
2006.09.17
DBGridEh и нереальное но...


15-1156740957
Rouse_
2006-08-28 08:55
2006.09.17
Петруха с ДР Тебя !!!


15-1156504684
syte_ser78
2006-08-25 15:18
2006.09.17
помогите с запросом




   Наверх