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

Вниз

Scrollbox   Найти похожие ветки 

 
puky   (2003-07-09 19:32) [0]

Как программно сделать скроллинг для ScrollBox?


 
Sapersky ©   (2003-10-13 15:36) [1]

Присоединяюсь.
Пробовал SetScrollInfo (WinAPI) - скроллится, но контрол в скролбоксе не обновляется, добавлял NotifyScrollBox - никакой реакции.


 
Gandalf ©   (2003-10-13 21:03) [2]

А если флаг fRedraw ставить?


 
Sapersky ©   (2003-10-14 09:49) [3]

fRedraw никак не влияет. Поставил SendMessage Scrollbox"у - заработало.


 
puky   (2003-10-20 16:12) [4]

2Sapersky
Можно пример?


 
puky   (2003-10-20 20:02) [5]

:) пример:

procedure ScrollIt( tx, ty : integer; ScrollBox, ScrollPanel : PControl );
var smin, smax: integer;
   sx, sy : integer;
begin

   if ((ScrollPanel.Left + tx) > 0 ) then tx := - ScrollPanel.Left ;
   if ((ScrollPanel.Top + ty) > 0 ) then  ty := - ScrollPanel.Top;
   if (ScrollPanel.Left + ScrollPanel.Width + tx - ScrollBox.ClientWidth) < 0 then
      tx := ScrollBox.ClientWidth - ScrollPanel.Left - ScrollPanel.Width ;
   if (ScrollPanel.Top + ScrollPanel.Height + ty - ScrollBox.ClientHeight) < 0 then
      ty := ScrollBox.ClientHeight - ScrollPanel.Top - ScrollPanel.Height ;

   { scroll }
   ScrollWindowEx( ScrollBox.handle, tx, ty, nil, nil, 0, nil, SW_SCROLLCHILDREN + SW_INVALIDATE + SW_ERASE );

   GetScrollRange( ScrollBox.handle, SB_HORZ , smin, smax );
   sx := GetScrollPos( ScrollBox.handle, SB_HORZ );
   sx := sx - tx;
   if sx < smin then sx := smin;
   if sx > smax then sx := smax;
   SetScrollPos( ScrollBox.handle, SB_HORZ , sx, true );

   GetScrollRange( ScrollBox.handle, SB_Vert , smin, smax );
   sy := GetScrollPos( ScrollBox.handle, SB_Vert );
   sy := sy - ty;
   if sy < smin then sx := smin;
   if sy > smax then sx := smax;
   SetScrollPos( ScrollBox.handle, SB_Vert , sy, true );

end;

юзать так:

procedure TForm1.Panel2MouseMove(Sender: PControl; var Mouse: TMouseEventData);
var tx, ty : integer;
begin
if md = 1 then begin
   { move panel }
   tx := Mouse.x - mx;
   ty := Mouse.y - my;
 
    ScrollIt( tx, ty, Sender.Parent , Sender );
end;
end;



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

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

Наверх




Память: 0.48 MB
Время: 0.175 c
6-1077816770
rrew
2004-02-26 20:32
2004.05.02
TServerSocket &amp; ClientSocket


3-1081222420
V-A-V
2004-04-06 07:33
2004.05.02
Пароль на базу Access


3-1080925781
Orvat
2004-04-02 21:09
2004.05.02
Понимаю, что не на тот сайт защел, но...


9-1069619329
DDS
2003-11-23 23:28
2004.05.02
Не могу поместить один GL_POLYGON перед другим, ерунда какая-то..


3-1081187625
SM
2004-04-05 21:53
2004.05.02
Как в SQL получить первые 10 записей из выборки