Graphics are measured in "pixels" (sometimes called "dots"). To set up a ruler you will need to know how many pixels there are in an inch (or centimeter). Typically this will be "96", but you should always let the operating system give you the correct value. In VB the statement would be:

Dim iDPIX As Integer = CType(Me.CreateGraphics.DpiX, Int32)

Once you have this value you can go ahead and build your ruler. To put marks at one inch intervals, just draw verticle lines at "iDPIX' intervals. For eighth inch intervals use "iDPIX \ 8". Beware of propagating a rounding error. For example, to calculate 7/8 of an inch use "7 * iDPIX \ 8" instead of "iDPIX \ 8 * 7".

To switch from inches to centimeters you would just convert "iDPIX" to "iDPIC" and then redraw your ruler.

Dim iDPIC = CType(iDPIX / 2.54, Int32)