Drawing a rectangle

This is a discussion on Drawing a rectangle within the Windows Programming forums, part of the Platform Specific Boards category; This code draws a rectangle but if I make it redraw the window, there is a pixel row on the ...

Drawing a rectangle

This code draws a rectangle but if I make it redraw the window, there is a pixel row on the sides between the content (part of it is rectangle) and border, which takes the color of the background behind that window and that stays until it needs to redraw it again. This is really strange. Code: