Is it possible to implement the following example for winforms in using the AJAX controls:
Private
Sub
TutorialCreatingASlideViewerWithRadRotator_Load(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
Me
.Load
Dim
myPicturesPath
As
String
= Environment.GetFolderPath(Environment.SpecialFolder.MyPictures)
For
Each
fileName
As
String
In
Directory.GetFiles(myPicturesPath,
"*.jpg"
)
RadRotator1.Items.Add(GetThumbNail(fileName))
Next
RadRotator1.Start(
True
)
RadRotator1.ShouldStopOnMouseOver =
False
End
Sub
Private
Function
GetThumbNail(
ByVal
path
As
String
)
As
RadImageItem
Dim
imageItem
As
New
RadImageItem()
Dim
image
As
Image = image.FromFile(path)
' workaround to prevent using internal image thumbnail
image.RotateFlip(System.Drawing.RotateFlipType.Rotate180FlipNone)
image.RotateFlip(System.Drawing.RotateFlipType.Rotate180FlipNone)
' calculate aspect ratio so image is not distorted
Dim
ratio
As
Double
= 0
If
image.Width > image.Height
Then
ratio = ClientRectangle.Width / image.Width
Else
ratio = ClientRectangle.Height / image.Height
End
If
Dim
newWidth
As
Integer
= Convert.ToInt32(image.Width * ratio)
Dim
newHeight
As
Integer
= Convert.ToInt32(image.Height * ratio)
imageItem.Image = image.GetThumbnailImage(newWidth, newHeight,
Nothing
, IntPtr.Zero)
Return
imageItem
End
Function
Private
Sub
RadRotator1_BeginRotate(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.WinControls.UI.BeginRotateEventArgs)
Handles
RadRotator1.BeginRotate
RadLabelElement1.Text = [
String
].Format(
"Rotating from item {0} to {1}"
, e.From, e.[
To
])
End
Sub