CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 1999
    Location
    Israel
    Posts
    1,793

    How exactly do i use OnNcPaint() ???

    Hi...
    im trying to draw my own window with bitmap as the frame...
    this is what i did so far:

    CMyDlg::CMyDlg()
    {
    m_FxBmp.LoadBitmap(IDB_FRAME_H);
    }
    void CMyDlg::OnNcPaint()
    {
    CRect NcRect;

    GetWindowRect(&NcRect) ;

    CDC *pDC=GetDC();

    m_FxBmp.DrawTransparent(pDC,NcRect.left,NcRect.right,RGB(0,0,0));
    //m_FxBmp is my class derived from CBitmap where i draw tranparent bmp's
    ReleaseDC(pDC);

    CWnd::OnNcPaint();
    }



    But all this doesnt work... i can see the bitmap drawn...
    what am i missing here??
    Any suggestions?
    Many thanks
    kishk91




    kishk91@hotmail.com
    http://www.path.co.il
    ICQ: 13610258

  2. #2
    Guest

    Re: How exactly do i use OnNcPaint() ???

    At end of Your cide You calls base class OnNcPaint which draw standard frame over Yours bitmap. Try remove this call!
    But! If You remive this You must draw ALL frame not only Bitmap.
    To avoid this try call CWnd::OnNcPaint() first before Your drawing code.
    Excuse my for my English.


  3. #3
    Join Date
    Jul 1999
    Location
    Israel
    Posts
    1,793

    Re: How exactly do i use OnNcPaint() ???

    Hi..
    thanks ..
    kishk

    kishk91@hotmail.com
    http://www.path.co.il
    ICQ: 13610258

  4. #4
    Join Date
    Jul 1999
    Location
    Israel
    Posts
    1,793

    Re: How exactly do i use OnNcPaint() ???

    Hi again...
    i still have some problems / questions..
    Let say that i have a bitmap 200 pixelx width and 10 pixels height.
    when i draw that frae witht the OnNcPaint and then handleing OnEraseBkgnd and draw my own background then the bkgnd bimp biting from the frame..
    how can i handle it??
    when drawn the background im getting the Client rect and drawing the bitmap inside the client rect, from this problem i understand that my frame's bitmap it takeing some of the client rect...
    any suggestions??
    many thanks
    kishk


    kishk91@hotmail.com
    http://www.path.co.il
    ICQ: 13610258

  5. #5
    Join Date
    Mar 2013
    Posts
    4

    Re: How exactly do i use OnNcPaint() ???

    Quote Originally Posted by ;217269
    At end of Your cide You calls base class OnNcPaint which draw standard frame over Yours bitmap. Try remove this call!
    But! If You remive this You must draw ALL frame not only Bitmap.
    To avoid this try call CWnd::OnNcPaint() first before Your drawing code.
    Excuse my for my English.
    It works good in windows 7 and earlier versions but it is not happening in windows 8 operating system. Any suggestion.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured