Support dynamic size change

Now support dynamic size change.
(Thanks Ricozor)