MDI-Child-Window: Größe ändern
-
Hallo,
ich habe in einer MDI-Anwendung ein Bild geladen und es auf das Client-Fenster
gezeichnet. Nun will ich noch das Client-Fenster in seiner Größe anpassen. Das
habe ich mit der Funktion "SetWindowPos()" probiert. Leider bleibt das Fenster
so groß wie es ist, aber zusetzlich wird ein feiner Rahmen in der Größe gezeichnet,
die ich in "SetWindowPos()" angegeben habe. Wie kann ich das Fenster denn jetzt
richtig verkleinern?void CImageMasterView::OnDraw(CDC* pDC){ CImageMasterDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); // Aus dem Document die BitmapInfo besorgen BITMAPINFO *tmpBitmapInfo = pDoc->GetBitmapInfo(); // Die Pixeldaten des Documents zeichnen SetDIBitsToDevice( pDC->GetSafeHdc(), 0, 0, tmpBitmapInfo->bmiHeader.biWidth, tmpBitmapInfo->bmiHeader.biHeight, 0, 0, 0, tmpBitmapInfo->bmiHeader.biHeight, pDoc->GetPixelData(), tmpBitmapInfo, DIB_RGB_COLORS); // Die Fenstergröße an das Bild anpassen // SetWindowPos( this, // Geht auch nicht SetWindowPos( NULL, 0, 0, tmpBitmapInfo->bmiHeader.biWidth + m_pBorderSize->cx, tmpBitmapInfo->bmiHeader.biHeight + m_pBorderSize->cy, SWP_NOMOVE | SWP_NOZORDER); }
-
Und wo steht, dass man innerhalb OnDraw das Fenster resizen sollte??
void CImageMasterView::OnInitialUpdate() { CImageMasterDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); // Aus dem Document die BitmapInfo besorgen BITMAPINFO *tmpBitmapInfo = pDoc->GetBitmapInfo(); // Die Fenstergröße an das Bild anpassen CRect rc( 0, 0, tmpBitmapInfo->bmiHeader.biWidth, tmpBitmapInfo->bmiHeader.biHeight); CWnd* pParent = GetParent(); pParent->CalcWindowRect( &rc, CWnd::adjustBorder); pParent->MoveWindow( 0, 0, rc.Width(), rc.Height()); }