SetSelectedAnnotationLineWidth Example VC++

This example uses the GetSelectedAnnotationLineWidth method to determine the width of a selected line annotation.  It then displays the line width in a text box control.

It also uses the SetSelectedAnnotationLineWidth method to set the width of a selected line annotation to the value entered in the text box control.

BOOL CLineWidth::OnInitDialog() 
{
    CDialog::OnInitDialog();
    int intLineWidth;
    long LineColor;
    
    // Get the line width and color to initialize the dialog box
    intLineWidth = m_pParent->ImgEdit1.GetSelectedAnnotationLineWidth();
    LineColor = m_pParent->ImgEdit1.GetSelectedAnnotationLineColor();
    
    // Set the current line width in the text box
    char tLineWidth [5];
    _itoa(intLineWidth,tLineWidth,10);
    m_Edit.SetWindowText(tLineWidth);

    return TRUE;  // return TRUE unless you set the focus to a control
                  // EXCEPTION: OCX Property Pages should return FALSE
}
void CLineWidth::OnOK() 
{
    CString tLineWidth;
    int iLineWidth;
    m_Edit.GetWindowText(tLineWidth);
    iLineWidth = atoi(tLineWidth);
    m_pParent->ImgEdit1.SetSelectedAnnotationLineWidth(iLineWidth);
    CDialog::OnOK();
}