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


Phenomenon

When to move zoomed Shapes, the position should be based on  the original size of the shapes.  But in remote (with Internet Explorer and Silverlight), zoomed triangle position to move is based on the zoomed size of triangle.

Following picture shows the shapes before running Shapes.Zoom().  This sample program ID is KTR748-3.  Mouse click will toggle workaround on/off.

Following picture shows the shapes after Shapes.Zoom() and Shapes.Move().  The positions are calculated based on the original size of the shapes.  The red crosses mean the positions for Shapes.Move().

Following picture shows the result in remote after Shapes.Zoom() and Shapes.Move().

How to Reproduce

Following code adds a triangle shape then zoom and move it.  The triangle zoomed will appear different place between in local and in remote.

GraphicsWindow.BrushColor = "LightGray"
GraphicsWindow.FillRectangle(x, y, width, height)
' orignal size and position
x1 = 0
y1 = 0
x2 = width
y2 = 0
x3 = width / 2
y3 = height
GraphicsWindow.BrushColor = "YellowGreen"
tri = Shapes.AddTriangle(x1, y1, x2, y2, x3, y3)
Shapes.Move(tri, x, y)
Program.Delay(2000)
' zoomed size and position
scaleX = 1.2
scaleY = 0.3
Shapes.Zoom(tri, scaleX, scaleY)
Shapes.Move(tri, x, y + (1 - scaleY) * height / 2)

Workaround

Following code includes the workaround in the last part of the repro program above.

' zoomed size and position
scaleX = 1.2
scaleY = 0.3
Shapes.Zoom(tri, scaleX, scaleY)
If silverlight Then
  Shapes.Move(tri, x + (1 - scaleX) * width / 2, y + (1 - scaleY) * height)
Else
  Shapes.Move(tri, x, y + (1 - scaleY) * height / 2)
EndIf


See Also