Delphi/CB
•  Greatis •  Security •  AppDatabase •  Utilities •  Visual Basic • .NET •  just4fun
Delphi / C++ Builder
Components, utilities and tips for Delphi and C++ Builder developers
Hot Offer
Save your money!
Featured
Ultimate Pack  hot!
Image Editor  new!
Runtime Fusion
Form Designer
Object Inspector
Print Suite Pro
Commented Image
Delphi Toys
WinDowse
Delphi Bonus
TMS Scripter Studio
Form Designer VB
Form Designer .NET

...get more...
for Delphi.NET, C#, VB.NET
for Delphi VCL, BCB 3-6

News Tips .NET Software VCL Software Partners  

Scroll image with ScrollBars
If your picture has very large width or height, then you may use ScrollBars for scrolling of this picture.
For example, ScrollBar1 will change a horizontal position of this picture and ScrollBar2 will change a vertical position of this picture. Set OnChange event to Scrollbar2Change for each ScrollBar.

var
  MyBitmap: TBitmap;

...

procedure TForm1.ScrollBar2Change(Sender: TObject);
var
  RectDest, RectSource: TRect;
begin
  RectDest:=Rect(0, 0, Image1.Width, Image1.Height);
  RectSource:=Rect(
    ScrollBar1.Position, 
    ScrollBar2.Position, 
    Scrollbar1.Position+Image1.Width, 
    ScrollBar2.Position+Image1.Height);
  Image1.Canvas.CopyRect(RectDest, MyBitmap.Canvas, RectSource);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  MyBitmap:=TBitmap.Create;
  MyBitmap.LoadFromFile('factory.bmp');
  Image1.Picture.Bitmap.Assign(MyBitmap);
  ScrollBar1.Max:=MyBitmap.Width-1-Image1.Width;
  ScrollBar2.Max:=MyBitmap.Height-1-Image1.Height;
end;

For more
Delphi Help

Download source


Our Partner
DevArchive.com
Recommended
just4fun
Useful Resources
Win32.hlp Online
Unix Manual Pages
MegaDetailed.NET
in3steps.com
Newsletters
Subscribe to our news!    Subscribe to our news!


Greatis Software Greatis | Security | AppDatabase | Utilities | Delphi/CB | Visual Basic | .NET | just4fun

Contacts | Add to Favorites | Recommend to a Friend | Privacy Policy | Copyright © 1998-2008 Greatis Software