Вниз
Скачать: 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 вся ветка

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



Память: 0.45 MB
Время: 0.024 c
1-1137591246
pepper
2006-01-18 16:34
2006.02.19
Документы Word, Excel в Webbrowser


2-1138783630
SDssss
2006-02-01 11:47
2006.02.19
перенести с С в Delphi5


2-1138970168
Делфёст
2006-02-03 15:36
2006.02.19
Индикатор выполнения задачи


1-1137585610
Kot_
2006-01-18 15:00
2006.02.19
Перекодировка ANSI в OEM


2-1138887535
Apl
2006-02-02 16:38
2006.02.19
TADOQuery




   Наверх