Painting depending on window size