LEADTOOLS Support
Imaging
Imaging SDK Examples
HOWTO: Center an image that is larger than the Main Control
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#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.
LEADTOOLS Support
Imaging
Imaging SDK Examples
HOWTO: Center an image that is larger than the Main Control
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.