CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 1999
    Location
    romania
    Posts
    43

    put a background pattern



    hello,

    I tried to put a pattern on the background of a crichedit control.

    OnInitDialog()

    {

    CBrush myBrush;

    CBitmap m_Bmp;

    m_Bmp.LoadBitmap(IDB_PAT);

    myBrush.CreatePatternBrush(&m_Bmp);

    ...//set the text in richedit

    }

    CPaint()

    {

    CDC * pCDC;

    CRect rect;

    rect.SetRect(x,y,l,h);

    pCDC->m_Rich.GetDC();

    pCDC->FillRect(rect, &myBrush);

    }


    The problem is the pattern appears on the text, not under it.

    Any suggestion is appreciated.


    Septimiu

  2. #2
    Join Date
    Mar 1999
    Posts
    8

    Re: put a background pattern



    You can't do this in an OnInitDialog - it needs to be done in a OnEraseBkgnd handler for the rich edit view.


    There is some code for CBitmapDialog that demonstrates this. I've applied this to CFormView and CTreeView without any problems and I assume this should work for CRichEditView.



  3. #3
    Join Date
    Apr 1999
    Location
    romania
    Posts
    43

    Re: put a background pattern



    Show me where I can find the code for CBitmapDialog

    and send to me the sources you write for CTreeView, please.

    Thank you,

    Septimiu



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