Share via


Small Basic Known Issue: 24270 - Shape Image is Not Zoomed Nor Rotated from Center in Remote

Introduction

Series of know issues articles are showing known issue itself about Small Basic and it's workaround. In this article, local means Small Basic IDE environment and remote means internet browser environment with Silverlight add-in.

Phenomenon 1

Shapes.Zoom() for image created by Shapes.AddImage() is zooming from center in local but from top-left corner in remote.

Picture 1 - Result in Local

Picture 2 - Result in Remote

Phenomenon 2

Shapes.Rotate() for image created by Shapes.AddImage() is rotating from center in local but from top-left corner in remote.

Picture 1 - Result in Local

Picture 2 - Result in Remote

Possible Cause

My guess about the reason of this phenomena is that the center position initialized in Shapes.AddImage will be broken by next Shapes operations.  This phenomena happens occasionally.  So I thought this issue may be related some timing.  I know another timing issue which breaks some GraphicsWindow properties in remote.  Then I tried inserting time delay to avoid this kind of timing issue as following workaround.  And that works well.

Workaround

To avoid this issue, insert delay just after Shapes.AddImage().

' Original
img = Shapes.AddImage(imageName)
Shapes.Zoom(img, scale,  scale)
Shapes.Move(img, x, y)

 

' Adjusted
img = Shapes.AddImage(imageName)
If silverlight Then
  Program.Delay(300)
EndIf
Shapes.Zoom(img, scale,  scale)
Shapes.Move(img, x, y)

Variable width and height contains image size. Caution: In remote, ImageList.GetWidthOfImage() and ImageList.GetHeightOfImage() return zeros. So these sizes should be initialized as constant.

Sample Programs

See Also

Small Basic: Difference Between Local and Remote