Click here to Skip to main content
15,891,708 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How To Get Pointer to Main Menu in case of MDI Application Pin
Gary Kirkham13-May-03 7:23
Gary Kirkham13-May-03 7:23 
QuestionHow to get data from a password protected webpage Pin
NorbertBehrens13-May-03 4:45
NorbertBehrens13-May-03 4:45 
GeneralPut button in CListCtrl Pin
JensB13-May-03 4:14
JensB13-May-03 4:14 
GeneralRe: Put button in CListCtrl Pin
basementman13-May-03 7:11
basementman13-May-03 7:11 
GeneralRe: Put button in CListCtrl Pin
Joan M13-May-03 21:52
professionalJoan M13-May-03 21:52 
GeneralCSpinButtonCtrl problem Pin
Trollslayer13-May-03 3:45
mentorTrollslayer13-May-03 3:45 
GeneralRe: CSpinButtonCtrl problem Pin
Rage13-May-03 4:07
professionalRage13-May-03 4:07 
GeneralOnly for the best ;o) Pin
MemLeak13-May-03 3:28
MemLeak13-May-03 3:28 
Hi,

I'm creating an MDI App containing non rectangular dialog.
It seems to work well because I can see my bitmap and the region seems to be well defined. My problem is that the removed part of my dialog is supposed to allow me to see my app background. Unstead, I see my desktop. Also, when I'm resizing, the removed part of my dialog dont refresh.

I have redefined OnPaint() and OnCreate(), OnEraseBkGround()

int BitmapDlgBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialogBar::OnCreate(lpCreateStruct) == -1)
return -1;

// Load the image
m_hBmp = (HBITMAP)LoadImage(GetModuleHandle(NULL), "C:\\Bitmap.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);

if(m_hBmp == NULL)
{
AfxMessageBox(_T("Error opening the Bitmap!"));
return 0;
}
// create a compatible device context
// for the bitmap. we will use this
// DC when painting the image onto
// the background of the window.

//CDC* dc = GetDC();
//m_hBitmapDC = CreateCompatibleDC( dc->m_hDC );
//ReleaseDC( dc );
//m_hOrigBmp = (HBITMAP)SelectObject( m_hBitmapDC, m_hBmp );

HDC dc = ::GetWindowDC(this->m_hWnd);
m_hBitmapDC = ::CreateCompatibleDC( dc );
::ReleaseDC(this->m_hWnd, dc);
m_hOrigBmp = (HBITMAP)SelectObject( m_hBitmapDC, m_hBmp );

// convert image to region. assume a magenta transparency color.
m_imageWidth = 0;
m_imageHeight = 0;

WindowRegion rgn;

HRGN hBmpRgn = rgn.CreateRegionFromImage( m_hBmp, RGB(255,0,255), m_imageHeight, m_imageWidth );

m_imageWidth = rgn.m_dwWidth;
m_imageHeight = rgn.m_dwHeight;

// resize the window with its height/width based on that of the bitmap.
SetWindowPos( NULL, 0, 0, rgn.m_dwWidth, rgn.m_dwHeight, SWP_NOZORDER | SWP_NOMOVE );

// finally, ask Windows to force the
// window to take on the shape of the
// region.
// note: the System owns the region
// after this call so there is no need
// to release it manually.
SetWindowRgn( hBmpRgn, FALSE );

return 0;
}

void BitmapDlgBar::OnPaint()
{
if ( GetUpdateRect(NULL,FALSE) )
{
PAINTSTRUCT ps;
ZeroMemory(&ps,sizeof(ps));
CDC* dc = BeginPaint(&ps);
BitBlt( dc->m_hDC, 0, 0, m_imageWidth,
m_imageHeight,
m_hBitmapDC,
0, 0, SRCCOPY);
EndPaint(&ps);
}
}

Any Ideas?

Regards

Everything's beautiful if you look at it long enough...
GeneralRe: Only for the best ;o) Pin
valikac13-May-03 8:41
valikac13-May-03 8:41 
GeneralRe: Only for the best ;o) Pin
MemLeak13-May-03 9:39
MemLeak13-May-03 9:39 
QuestionCan anyone help me please???? Pin
andreshs113-May-03 3:08
andreshs113-May-03 3:08 
GeneralMessages for dynamic created controls Pin
Frank Christensen13-May-03 3:00
Frank Christensen13-May-03 3:00 
GeneralRe: Messages for dynamic created controls Pin
Rage13-May-03 4:18
professionalRage13-May-03 4:18 
GeneralTrackPopupMenu(...) outside *this wnd. Pin
Michael Pauli13-May-03 2:49
Michael Pauli13-May-03 2:49 
GeneralRe: TrackPopupMenu(...) outside *this wnd. Pin
Miszou13-May-03 7:41
Miszou13-May-03 7:41 
GeneralRe: TrackPopupMenu(...) outside *this wnd. Pin
Michael Pauli13-May-03 12:21
Michael Pauli13-May-03 12:21 
GeneralDialog Pin
macmac3813-May-03 2:49
macmac3813-May-03 2:49 
GeneralRe: Dialog Pin
Martyn Pearson13-May-03 3:11
Martyn Pearson13-May-03 3:11 
GeneralRe: Dialog Pin
macmac3813-May-03 3:55
macmac3813-May-03 3:55 
GeneralRe: Dialog Pin
Martyn Pearson15-May-03 4:28
Martyn Pearson15-May-03 4:28 
GeneralScrolling a ClistView with shared scroll-bar Pin
schoni13-May-03 2:49
schoni13-May-03 2:49 
GeneralToolbar with combo box question Pin
Heywood13-May-03 2:36
Heywood13-May-03 2:36 
QuestionHow to consume base64Binary xml using C++ ? Pin
Anthony_Yio13-May-03 1:24
Anthony_Yio13-May-03 1:24 
QuestionRegister TLB, does it makes sense ??? Pin
Braulio Dez13-May-03 1:23
Braulio Dez13-May-03 1:23 
QuestionMemory leak detection... the best solution? Pin
Raphael Kindt13-May-03 1:10
Raphael Kindt13-May-03 1:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.