Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » problem on Drawing Image on MDI Main Frame background using Profuis. Collapse All
Subject Author Date
Gunasekaran Velu Nov 9, 2006 - 1:48 AM


Hi

i can’t draw the Drawing Image on MDI Main Frame background using profuis application but i can Drawing Image on MDI Main Frame background without using profuis application? can u help me. i am using profuis 2.60

Thanks and Regards
Guna

Technical Support Nov 9, 2006 - 1:12 PM

You could simply subclass the MDI client area and handle the painting messages:

class CMyMdiClientAreaWnd : public CWnd
{
protected:
    virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
    {
        if( message == WM_ERASEBKGND )
            return TRUE;
        if( message == WM_PAINT )
        {
            CPaintDC dc( this ); 
            CRect rc; 
            GetClientRect( &rc );
            dc.FillSolidRect( &rc, RGB(0,255,0) ); // draw entirely green background
            return TRUE;
        }
        return CWnd::WindowProc( message, wParam, lParam );
    }
};
Then define the following property in your main frame class:
CMyMdiClientAreaWnd m_wndMyMdiClientArea;
and invoke this line somewhere at the end of the OnCreate() handler method of your main frame class:
m_wndMyMdiClientArea.SubclassWindow( ::GetDlgItem( m_hWnd, AFX_IDW_PANE_FIRST ) );



Gunasekaran Velu Nov 9, 2006 - 10:19 PM


hi

thank u for help but in this i want to load the the bmp file and show on MDI Main frame background. help me.

Technical Support Nov 10, 2006 - 10:51 AM

Here is another version of the CMyMdiClientAreaWnd class which loads and paints the IDB_BITMAP1 bitmap resource:

class CMyMdiClientAreaWnd : public CWnd
{
public: 
    CExtBitmap m_bmp;
    CMyMdiClientAreaWnd()
    {
        VERIFY( m_bmp.LoadBMP_Resource( IDB_BITMAP1 ) );
    }
protected:
    virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
    {
        if( message == WM_ERASEBKGND )
            return TRUE;
        if( message == WM_PAINT )
        {
            CPaintDC dc( this ); 
            CRect rc; 
            GetClientRect( &rc );
            m_bmp.Draw( dc.m_hDC, rc );
            return TRUE;
        }
        return CWnd::WindowProc( message, wParam, lParam );
    }
};

Gunasekaran Velu Nov 11, 2006 - 12:23 AM



Thanks its working.

Gunasekaran Velu Nov 24, 2006 - 9:55 PM

hi

thanks but one problem the image displayed in strch mode.i don’t know why this is happended. its not look like original image. can u help me.

Thanks and Regards
Guna

Technical Support Nov 26, 2006 - 9:22 AM

In fact you should replace

m_bmp.Draw( dc.m_hDC, rc );
with
CRect rcPadding( 0, 0, 0, 0 );
CExtBitmap::e_DrawMethod_t eDM = CExtBitmap::__EDM_TILE;
m_bmp.DrawSkinParts( dc.m_hDC, rc, rcPadding, true, true );
You can also try replacing __EDM_TILE with __EDM_TILE_H or __EDM_TILE_V and try resizing the window to find out which type of painting you need.

Technical Support Nov 26, 2006 - 9:19 AM

Please replace the following line:

m_bmp.Draw( dc.m_hDC, rc );
with
CRect rcPaddingm_bmp.Draw( dc.m_hDC, rc );

Gunasekaran Velu Nov 27, 2006 - 12:18 AM



thanks dude its work fine..

Thanks and Regards
Guna