Display Example VC++

This example displays a user-selected image file in an Image Edit control.

void CImgEdit1Dlg::OnDisplay() 
{
    // Use the ImgAdmin Open dialog box to display a file in the
    // Image Edit and Thumbnail controls.
    
     VARIANT vhWnd; V_VT(&vhWnd) =  VT_I4;
    V_I4(&vhWnd) = (long)m_hWnd;
    ImgAdmin1.ShowFileDialog(0,vhWnd); // OpenDlg
    //See the sample code for handling the Cancel key in the
    //ShowFileDialog method
    // Set the image properties in the Image Edit and Thumbnail controls
    // to the name of the file selected in the dialog box.
    ImgEdit1.SetImage(ImgAdmin1.GetImage());
    ImgThumbnail1.SetImage(ImgAdmin1.GetImage());
    // Set the page to 1 in case a page other than 1 was shown
    // for an image displayed prior to this one
    ImgEdit1.SetPage(1);
    ImgEdit1.Display();
    // Set the focus to the image window so that keystrokes such
    // as scroll keys are sent to the image window.
    ImgEdit1.SetFocus();
}