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

Можно ли создать своё окошко для подсказки (hint) и если да, то как?   Найти похожие ветки 

← →
cdaDMITRIY ©   (2002-03-25 13:55) [7]

RE : The WORK ---> cdaDMITRIY .

http://delphi.vitpc.com/treasury/hintlistbox.htm


Автор Агранович Олег,
дата публикации 19 марта 2002г.

При движении по списку TListBox содержимое каждой строки показывается с помощью Hint-а. Код поддерживает обработку нескольких TListBox на форме.

{Вставляем в раздел public вашей формы:}

procedure ShowHint (var HintStr: string;
var CanShow: Boolean; var HintInfo: THintInfo);

{Вставляем где нибудь после implementation:}

procedure TForm1.ShowHint (var HintStr: string;
var CanShow: Boolean; var HintInfo: THintInfo);
var
ListRect,a: TRect;
begin
with HintInfo do
begin
{Здесь необходимо указать все ListBox на вашей форме, например в
этом случае это ListBox1 и ListBox2}
if (HintControl = ListBox1)or(HintControl = ListBox2) then
with HintControl as TListBox do
begin
if (ItemAtPos(CursorPos,true)<>-1)and
(Canvas.TextWidth(items.Strings[ItemAtPos(CursorPos,true)]) >
ItemRect(ItemAtPos(CursorPos,true)).Right-2)then
begin
HintStr := items.Strings[ItemAtPos(CursorPos,true)];
ListRect := ClientRect;
ListRect.Top := ListRect.Top + (ItemAtPos(CursorPos,true)-TopIndex)*ItemHeight;
ListRect.Bottom := ListRect.Top + ItemHeight;
CursorRect := ListRect;
GetWindowRect(Handle,a);
HintInfo.HintPos:=Point(ListRect.Left+a.Left+1,ListRect.Top+a.Top-1);
end;
end;
end;
end;

{В обработчике FormShow формы прописываем:}
Application.OnShowHint := ShowHint;
Application.HintHidePause:=5000; //Время которое будет держаться Hint.
Application.HintPause:=300; //Время перед появлением Hint"а.

{В обработчике FormHide формы прописываем:}
Application.HintHidePause:=2500;
Application.HintPause:=500;

Во всех ListBox"ах устанавливаем свойсто ShowHint в True
Агранович Олег





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

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



Память: 0.45 MB
Время: 0.013 c
3-9406
Tanya_
2002-03-12 19:47
2002.04.04
ApplyUpdate и связь master-detail


14-9636
Evgueni
2002-02-20 22:42
2002.04.04
Посоветуйте прокси хороший...


3-9393
shovqi
2002-03-12 16:09
2002.04.04
report


3-9412
Malder
2002-03-02 17:35
2002.04.04
Насчет удаленных записей в Interbase


1-9536
DRUG
2002-03-14 06:10
2002.04.04
Проблема с формой




   Наверх