Share via


Small Basic Known Issue: 21691 - Rectangle and Ellipse Become Smaller 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

GraphicsWindow.DrawRectangle() and GraphicsWindow.DrawEllipse() draw shapes GraphicsWindow.PenWidth smaller than original in remote.  Picture 1 shows a rectangle and an ellipse in local.  Picture 2 shows the same result in remote.

Picture 1 - Result in Local

Picture 2 - Result in Remote

Workaround

To avoid this issue, adjust x, y, width and height as follows.

'Original
GraphicsWindow.PenWidth = pw
GraphicsWindow.DrawRectangle(x, y, width, height)
'Adjusted
GraphicsWindow.PenWidth = pw
If silverlight Then
  GraphicsWindow.DrawRectangle(x - pw  / 2, y -  pw / 2, width +  pw, height + pw) ' for remote
Else
  GraphicsWindow.DrawRectangle(x, y, width, height)  ' for local
EndIf

Sample Program

http://smallbasic.com/program/?VLB465

See Also

Small Basic: Difference Between Local and Remote