Graham
"Paul Nicholls" <pha...@southcom.com.au> 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 : pha...@southcom.com.au
>
> < IF YOU WANT TO EARN MONEY WHILE YOU SURF ON THE NET GO HERE: >
> < http://www.alladvantage.com/go.asp?refid=BEM-274 >
>
>
I am using TImage for persistence. It means I don't have to draw the
background stuff all the time in a paint method or similar. The problem is
that the scrollbox doesn't have any scrolling events for me to trap to
update the image when the image is 'expanded'when the scrollbox is scrolled.
>If you have to
>draw dynamically, just use a TScrollBar with a TPanel (or TPaintBox or
>whatever) and trap the scrollbar movements for drawing.
I am also storing controls inside the the scrollbox as I thought this was
the easiest way to store the controls and allow them to scroll and move
around. I want to draw on the image when displaying linking lines between
components when they are joined together...
--
I guess I still may not be understanding what you want to do. Here's what I
think you want:
1. Put a TScrollBox on the form. Let's say that Height = 300, Width = 400.
2. Put a TImage in the TScrollBox. Set its dimensions to 900x700
3. Put your controls on the TImage (they will still have the TScrollBox as
their parent, but will appear above the TImage.
4. Draw, scroll, etc. to your heart's content.
I did something like this a couple of years ago (a quiz program with buttons
and edit fields on a scrolling form) and it worked fine.
Is this not what you wanted?
Graham
"Paul Nicholls" <pha...@southcom.com.au> wrote in message
news:39360dca@dnews...
Graham
"Graham Stratford" <stratford.@NOSPAMkb.jcs.co.jp> wrote in message
news:39361a37@dnews...
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.geocities.com/den_alex
"Paul Nicholls" <pha...@southcom.com.au> 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 : pha...@southcom.com.au
< IF YOU WANT TO EARN MONEY WHILE YOU SURF ON THE NET GO HERE: >
< http://www.alladvantage.com/go.asp?refid=BEM-274 >