There are two probable cuprits here. First, the video driver might be corrupted. Download the correct driver from HP/Compaq and install it. Hopefully this will fix it. Second, the video card may be failing. If so, then you might be able to replace it if it isn't integrated (it probably is, though). If the card is integrated, then you would have to replace the whole motherboard.
My brother has a 4 year old Compaq laptop running Windows 98 with a display problem. Upper two thirds of the screen display correctly but the lower third repeats the top of the display. I assume the problem is a setting somewhere but changing screen resolution doesn't seem to help