Implemented refreshing a canvas whenever draw a component.