Welcome Guest! To enable all features, please Login or Register.



Last Go to last post Unread Go to first unread post
#1 Posted : Sunday, October 6, 2013 5:10:18 AM(UTC)


Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

Below is a simple VB snippet to load an image that is larger than the LEAD control and have the center of that image in the center of the lead control while AutoScroll is true.
Private Sub Command1_Click() Dim l As Long
Dim t As Long
LEAD1.Visible = False LEAD1.Load "ImagePath", 0, 0, 1
'Calculate where to set the dst rect to have the center of the image in the center of the control.
'The top and left have to be negative to scroll into the image.
l = -((LEAD1.BitmapWidth / 2) - (LEAD1.ScaleWidth / 2))
t = -((LEAD1.BitmapHeight / 2) - (LEAD1.ScaleHeight / 2))
LEAD1.SetDstRect l, t, LEAD1.BitmapWidth, LEAD1.BitmapHeight
LEAD1.SetDstClipRect l, t, LEAD1.BitmapWidth, LEAD1.BitmapHeight
LEAD1.Visible = True
End Sub

In the .NET classes, you can accomplish this using the RasterImageViewer.SizeMode property.

This was previously published as 249LHQ.

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.028 seconds.