Resize question.

I have this in my web page resize event.

[code] ImageView1.ZIndex = 0

mLoginControl = new LoginControl
mLoginControl.Enabled = true
mLoginControl.Visible = true

mLoginControl.EmbedWithin(self, 0, 0, mLoginControl.Width, mLoginControl.Height)
AddHandler mLoginControl.LoginPressed, addressof LoginPressed


[code]Sub ShowCenteredInParent(parent as WebPage)
Left = (parent.width - Width) / 2
top = (parent.height - Height) / 2

if left < 0 then left = 0
if top < 0 then top = 0
if left > parent.width then left = 0
if top > parent.height then top = 0

if Width = 0 then
System.DebugLog(“Wait a second. w=” + str(Width) + " h=" + str(Height))
end if

Visible = true
ZIndex = 30

End Sub
However when I resize the display the original control is still on the screen and a new one is in the center…

Not sure how to fix this…

This is because you are making a new Instance of your LoginControl and embedding it everytime the page is resized, You should only add it once in the Page Shown event and save a reference to it as a property on the page.
Modify its position using the page’s property.