Text on a line segment

Can someone help to create a code to write text on a line segment, below or above. Something like what the in-built editor produces for CursorMode = cmMeasure and tkMeasuringType::MeasureDistance.
My objective is to reproduce the above as part of the map

Here is a snippet of code I use to display a shapefile of roads (gravel and paved surface) labeled with the road name above each road section. Its for VB.net, maybe you can adapt it for your purposes.

            sf = New MapWinGIS.Shapefile
            hnd = Map1.AddLayer(sf, True)
            Map1.set_LayerVisible(hnd, True)
                  'setup 2 categories for the line styles'
            Dim ct1 As MapWinGIS.ShapefileCategory = sf.Categories.Add("Dirt")
            ct1.DrawingOptions.LineColor = System.Convert.ToUInt32(RGB(80, 80, 80))
            ct1.DrawingOptions.LineStipple = MapWinGIS.tkDashStyle.dsDash
            ct1.DrawingOptions.LineWidth = 4
            ct1.DrawingOptions.LineVisible = True
            ct1.Expression = "[cti_type] = 2"

            Dim ct2 As MapWinGIS.ShapefileCategory = sf.Categories.Add("Paved")
            ct2.DrawingOptions.LineColor = System.Convert.ToUInt32(RGB(50, 50, 50))
            ct2.DrawingOptions.LineWidth = 5
            ct2.DrawingOptions.LineVisible = True
            ct2.Expression = "[cti_type] = 1"
                    'apply the styles'
                    'define the labels, using the data field: mapname'
            With sf.Labels
                .Generate("[mapname]", MapWinGIS.tkLabelPositioning.lpMiddleSegment, False)
                .OffsetY = -14
                .FrameBackColor = System.Convert.ToUInt32(RGB(240, 240, 240))
                .FrameOutlineColor = System.Convert.ToUInt32(RGB(240, 240, 240))
                .FrameTransparency = 0
                .AvoidCollisions = True
                .VerticalPosition = MapWinGIS.tkVerticalPosition.vpAboveAllLayers
                .CollisionBuffer = 1
            End With