void CVierOpRijDlg::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); if(!::IsWindow(m_VierOpRijWnd.m_hWnd)) return; RelocateControls(); }
BOOL CVierOpRijDlg::OnInitDialog() { CDialog::OnInitDialog(); // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon CRect rectClient; GetClientRect(&rectClient); rectClient.DeflateRect(10,10); m_VierOpRijWnd.Create(NULL, NULL, WS_VISIBLE | WS_CHILD, rectClient, this, 0xFF); SetDlgItemText(IDC_EDIT_LEVEL, L"-1"); SetTimer(0, 100, NULL); RelocateControls(); return TRUE; // return TRUE unless you set the focus to a control }
void CImageView::ShowImage(QString &strPathName) { const CString &Path = strPathName; Jpeg jpeg; ZeroMemory(&jpeg, sizeof(jpeg)); if (!m_JpegCodec.GetJpegInformation((LPCTSTR) Path, &jpeg)) return; if (m_dwBufferLength < jpeg.dwLength) { if (m_pBuffer) _aligned_free(m_pBuffer); m_pBuffer = (BYTE *) _aligned_malloc(jpeg.dwLength, 16); m_dwBufferLength = jpeg.dwLength; } jpeg.pBuffer = (BYTE *) m_pBuffer; if (!m_JpegCodec.Decode((LPCTSTR) Path, &jpeg)) { return; } int width = (jpeg.bm.biWidth<= 360)?(2*jpeg.bm.biWidth):(jpeg.bm.biWidth); int height = (jpeg.bm.biHeight<= 288)?(2*jpeg.bm.biHeight):(jpeg.bm.biHeight); DWORD dwEngId = _ttoi(m_strEngId.GetBuffer()); CRect rcVCAROI; VCA5_RECT rcROIEng = CAPPConfigure::Instance()->GetAPPEngineInfo( dwEngId )->tSourceData.rcROI; rcVCAROI.left = rcROIEng.x; rcVCAROI.top = rcROIEng.y; rcVCAROI.right = rcROIEng.x + rcROIEng.w; rcVCAROI.bottom = rcROIEng.y + rcROIEng.h; if( rcVCAROI.Size() == CSize(0, 0) ) { rcVCAROI.CopyRect(&m_ClientRect); } else { rcVCAROI.right = min(rcVCAROI.right-1, width); rcVCAROI.bottom = min(rcVCAROI.bottom-1, height); PIXELTOPERCENT(rcVCAROI.left, rcVCAROI.left, width); PIXELTOPERCENT(rcVCAROI.top, rcVCAROI.top, height); PIXELTOPERCENT(rcVCAROI.right, rcVCAROI.right, width); PIXELTOPERCENT(rcVCAROI.bottom, rcVCAROI.bottom, height); PERCENTTOPIXEL(rcVCAROI.left, rcVCAROI.left, m_ClientRect.right); PERCENTTOPIXEL(rcVCAROI.top, rcVCAROI.top, m_ClientRect.bottom); PERCENTTOPIXEL(rcVCAROI.right, rcVCAROI.right, m_ClientRect.right); PERCENTTOPIXEL(rcVCAROI.bottom, rcVCAROI.bottom, m_ClientRect.bottom); } m_ClientRect.left = 0; m_ClientRect.top = 0; m_ClientRect.right = width; m_ClientRect.bottom = height; AdjustDlgRect(width, height); RelocateControls(width, height); DrawImage(jpeg.bm.biWidth, jpeg.bm.biHeight, jpeg.pImage, jpeg.bm); DrawSingleZone(rcVCAROI, jpeg.pZone); DrawObject(rcVCAROI, jpeg.bm.biWidth, jpeg.bm.biHeight, jpeg.pObject); if(jpeg.pRule) DrawTimeStampAndRuleType(jpeg.bm.biWidth, jpeg.bm.biHeight, jpeg.i64TimeStamp, jpeg.pRule->usRuleType); RECT ScreenRect; ScreenRect = m_ClientRect; ClientToScreen((POINT*)&ScreenRect.left ); ClientToScreen((POINT*)&ScreenRect.right ); m_pD3d->PrimaryPresentation(&ScreenRect, &m_ClientRect); }