R
Also, ich habe es so gemacht:
CFileDialog dlg(TRUE,
".bmp",
NULL,
OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
szFilter);
//
dlg.m_ofn.lpstrTitle="Logo-Datei öffnen";
m_strLogodatei = "";
if (dlg.DoModal()!=IDOK)
{
return;
}
m_strLogodatei = dlg.GetPathName();
hBitmap = (HBITMAP) ::LoadImage(
AfxGetInstanceHandle(),
m_strLogodatei, //DateiName deines Bildes
IMAGE_BITMAP,
0,
0,
LR_LOADFROMFILE|LR_CREATEDIBSECTION);
und dann in der OnPaint:
if (IsIconic())
{
}
else
{
if (m_strLogodatei != "")
{
HDC hMemDC = CreateCompatibleDC(NULL);
SelectObject(hMemDC, hBitmap);
::StretchBlt( dc.m_hDC, //Ziel
m_bildpos.left+4,//links oben
m_bildpos.top, m_bildpos.Width()
.....
hMemDC, //Quelle
0,
0,
m_bmpheader.biWidth,//Breite
m_bmpheader.biHeight,//Höhe
SRCCOPY); //Modus
::DeleteDC(hMemDC);
::DeleteObject(hBitmap);
CDialog::OnPaint();
}
}
Gruß
Russak