Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2006.02.19;
Скачать: CL | DM;

Вниз

Можно ли в ListBox узнать по какой букве в строке был клик   Найти похожие ветки 

 
ListBox   (2006-02-04 00:26) [0]

или по какому слову в строке?


 
vidiv ©   (2006-02-04 12:24) [1]

Без изврата - врядли.


 
vidiv ©   (2006-02-04 12:56) [2]

Вот пример изврата:

procedure TForm1.ListBox1MouseUp(Sender: TObject; Button: TMouseButton;
 Shift: TShiftState; X, Y: Integer);
var ir: TRect;
   i,j:integer;
   s:string;
   ListBox:TListBox;
begin
 ListBox := Sender as TListBox;
 j := ListBox.ItemAtPos(Point(X, Y), True);
 if j>=0 then begin
   ListBox.Canvas.Font := ListBox.Font;
   ir := ListBox.ItemRect(j);
   x := x - ir.Left - 2;
   s := ListBox.Items[j];
   j := 0;

   for i:=1 to length(s) do begin
     if ListBox.Canvas.TextWidth(copy(s, 1, i)) > x then begin
         j := i;
         break
       end;
   end;
   if j > 0 then begin
     showmessage("Вы кликнули по букве номер "+inttostr(j));
   end else begin
     showmessage("Вы не попали по букве");
   end;
 end;
end;


 
Gero ©   (2006-02-04 12:59) [3]

Можно, но в общем случае довольно сложно.


 
ListBox   (2006-02-04 20:35) [4]

Спасибо!



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

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

Наверх




Память: 0.47 MB
Время: 0.051 c
2-1138892839
dera
2006-02-02 18:07
2006.02.19
Как в символьном поле с помощь Local SQL найти значение *ВАН*?


15-1138389157
tesseract
2006-01-27 22:12
2006.02.19
Проблемы у Reactos


15-1138613261
kkot
2006-01-30 12:27
2006.02.19
Жители Кишнева, вопрос к вам.


2-1139040526
Julia
2006-02-04 11:08
2006.02.19
Как объявить тип TDateSetState?


10-1112176388
Lamos
2005-03-30 13:53
2006.02.19
ExcelApplication1.AddIns.Add