I want to draw a rule on left hand side of a richtextbox, it would have line numbers and should scroll whenever richtextbox scrolls

To do that; i've two options
1. Place ruler and richtextbox on an panel; but the problem is that how can i synronize sroll operation!
2. Extend richtextbox and draw a ruler; but how can i tell base class not to draw over my ruler!

Does anyone have an idea either one of them!

I would be great to see a c# code :)