AnnotationLineWidth Example VC++

This example draws a 10-pixel-wide line across the width of an image.

void CImgEdit1Dlg::OnDrawline() 
{
    // This would draw a line across the width of an image
    
    long XWidth;
     
    // Determine the width of the image -- this will
    // work even if the image is scaled up or down
    XWidth = ImgEdit1.GetImageScaleWidth();
    
    // line will be green, transparent, 10 pixels wide
    ImgEdit1.SetAnnotationLineColor(0xFF00);    // vbGreen
    ImgEdit1.SetAnnotationLineStyle(0);  // 0
    ImgEdit1.SetAnnotationLineWidth(10); // 10
    ImgEdit1.SetAnnotationType(1); // wiStraightLine 1
    
    // Draw the line
    // left position = 0 (start at left side)
    // top position = 100 pixels from top of page
    // width of line = width of image as it is displayed
    // height of line = 0 (line will be horizontal)
    VARIANT vWidth; V_VT(&vWidth) = VT_I4; V_I4(&vWidth) = XWidth;
    VARIANT vHeight; V_VT(&vHeight) = VT_I4; V_I4(&vHeight) = 0;
    ImgEdit1.Draw(0, 100, vWidth, vHeight);
}