Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2006.09.17;
Скачать: 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 вся ветка

Текущий архив: 2006.09.17;
Скачать: CL | DM;

Наверх




Память: 0.46 MB
Время: 0.038 c
15-1156332930
DonVik
2006-08-23 15:35
2006.09.17
Почему только Делфи?


15-1156191797
Piter
2006-08-22 00:23
2006.09.17
Методы работы антивирусных почтовых сканеров


15-1156319224
IGray
2006-08-23 11:47
2006.09.17
Перегнать DOC --> PDF с оглавлением


5-1139574788
superoberon
2006-02-10 15:33
2006.09.17
ShellTreeView и ShellListView


15-1156925866
Зм1й
2006-08-30 12:17
2006.09.17
Проблемка с телефоном