Pic18f4550 oscilloscope
As you haven't provided a schematic diagram of the circuit you are using, I'll have to shoot in the dark on what might be the problem.

One thing that could result in lowering signal amplitude with frequency is having a circuit acting as a low-pass filter in front of the ADC. 
Do you have any capacitors and resistors before the ADC input?
Also, have you buffered the ADC input with an op-amp, or is the input source connected directly to it?
According to the datasheet, the maximum recomended impedance of the signal source in 2.5k (page 272), or else there would be higher measurement error that specified.

Another thing that I've noticed is that at 20MHz, according to the equations provided in the datasheet (page 272) your maximum possible sampling frequency is around  65kHz (if you want to be using the 10 bits of resolution). If I'm not mistaken about the 65k, it means that at 40kHz you would be above the Nyquist frequency and should be seeing aliasing effects.

So yeah... 1MHz with this MCU is a no go as a real time oscilloscope. You need one with higher bandwidth ADC and with higher clock frequency.

Hope that answers your question!
Keep trying!