Вниз
Скачать: 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.026 c
15-1138798659
Влад
2006-02-01 15:57
2006.02.19
Как вам вот такие ГИС проекты


9-1125311577
Chel
2005-08-29 14:32
2006.02.19
Вопрос по OpenGL


1-1137573956
zorik
2006-01-18 11:45
2006.02.19
советы по оптимизации експорта в Excel


15-1138265524
AlexD
2006-01-26 11:52
2006.02.19
Windows XP


3-1135161994
Drakosha
2005-12-21 13:46
2006.02.19
FastReport проблемы с отображением rtf




   Наверх