0
votes

I try to zoom in or out a picture in small steps until it fills the screen. My code: While I <> Math.Round(ZoomFactor, 2) If ZoomFactor >= 1 Then I = I + 0.01 ZoomPicture(1.01) Else I = I - 0.01 ZoomPicture(0.99) End If Me.PictureBox1.Update() End While Private Sub ZoomPicture(ZoomFactor) Dim BiggerImage As Bitmap BiggerImage = New Bitmap(PictureBox1.Image, PictureBox1.Image.Width * ZoomFactor, PictureBox1.Image.Height * ZoomFactor) PictureBox1.Image = BiggerImage End Sub

This works, but the zooming is a bit jerky (not smooth). I would like it to be like a movie (so mnimum 24 zooms/seconds).

Is there a better way to achieve this? But not too complicated (I think using DirectX is very complicated, or isn't it?)

Thanks a lot for an useful information

Marc

1
Is there a better way to achieve this? Probably you may achive that with XLL. The problem lies in VBA itself, i.e.VBA Engine performance. - Aleksey F.
What is XLL? I know fortran, colbol, basic, pascal, visual basic. I prefer not to learn a new language at my age. - Marc
Please, have a look at the link referenced with "XLL". It's an SDK supporting C/C++ as native languages, hence, others after porting header files. Maybe someone already has ported XLL SDK into one of your preffered languages. - Aleksey F.
I don't know C or C++. Is there no solution in VB? - Marc
others (languages) after porting header files. Maybe someone already has ported XLL SDK into one of your preffered languages. - Aleksey F.

1 Answers

0
votes

I use the following now:

While PictureBox1.Image.Height < ScreenHeight And (Microsoft.VisualBasic.DateAndTime.Timer - StartTime) < ScreenSaverDuration
      PictureBox1.Image = New Bitmap(Image1, PictureBox1.Image.Width * 1.003, PictureBox1.Image.Height * 1.003)
      Me.PictureBox1.Update()
End  While

This works reasonably well