From: "Alex Denissov" Subject: Re: TScrollBox and scrollbars Date: 02 Jun 2000 00:00:00 GMT Message-ID: <393854c2@dnews> References: <393602cf@dnews> X-Trace: 2 Jun 2000 17:43:46 -0800, 137.207.80.80 X-MSMail-Priority: Normal X-Priority: 3 Newsgroups: borland.public.delphi.graphics X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 Paul, If you need to catch scrolling events, you may use WM_HSCROLL or WM_VSCROLL messages, for example: ----------------------------------------- unit EnhScrollBox; interface uses Windows, Messages, SysUtils, Classes, Controls, Forms; type TEnhScrollBox = class(TScrollBox) private FOnScrollHorz: TNotifyEvent; FOnScrollVert: TNotifyEvent; protected procedure DoScrollHorz; dynamic; procedure DoScrollVert; dynamic; procedure WMScrollHorz(var Msg: TMessage); message WM_HSCROLL; procedure WMScrollVert(var Msg: TMessage); message WM_VSCROLL; published property OnScrollHorz: TNotifyEvent read FOnScrollHorz write FOnScrollHorz; property OnScrollVert: TNotifyEvent read FOnScrollVert write FOnScrollVert; end; procedure Register; implementation procedure Register; begin RegisterComponents('Additional', [TEnhScrollBox]); end; { TEnhScrollBox } procedure TEnhScrollBox.DoScrollHorz; begin if Assigned(FOnScrollHorz) then FOnScrollHorz(Self); end; procedure TEnhScrollBox.DoScrollVert; begin if Assigned(FOnScrollVert) then FOnScrollVert(Self); end; procedure TEnhScrollBox.WMScrollHorz(var Msg: TMessage); begin inherited; DoScrollHorz; end; procedure TEnhScrollBox.WMScrollVert(var Msg: TMessage); begin inherited; DoScrollVert; end; end. --------------------------------------- The new position may be obtained from standard HorzScrollBar and VertScrollBar properties. -- Alex Denissov http://www.g32.org [link updated 23 Sept 2001] "Paul Nicholls" wrote in message news:393602cf@dnews... > Hi all, I have a TScrollBox with a TImage inside it to act as a canvas for > some drawing. I am drawing grid dots onto the image during the Form.Show > event and I was wondering how I could catch when the scrollbox 'canvas' is > scrolled and hidden parts are now revealed. I want to do this so I can > update the grid dots onto the newly revealed sections of the image which at > the moment are blank. > Any hints/tips/code? I am using Delphi 3 Standard. > > Thanks in advance, > Paul Nicholls, > Live long and optimise! > > Home Page: www.southcom.com.au/~phantom > Email : phantom@southcom.com.au