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

    SetBkMode(TRANSPARENT)???

    Hi,
    SetBkMode(TRANSPARENT) , does anyone know anything about it ?
    I have an image on which i want to add a grid, but on some computers the
    background becomes white.
    Has anyone seen this before ?

    xnxn

  2. #2
    Join Date
    Aug 1999
    Posts
    107

    Re: SetBkMode(TRANSPARENT)???

    I use this mode when using some of my drawing functions. What specifically do you want to know about it, I may be able to help


  3. #3
    Join Date
    Jun 1999
    Posts
    37

    Re: SetBkMode(TRANSPARENT)???

    Thanks for your reply,

    I have an image on which i want to add a grid, but on some computers the
    background becomes white.

    Here is the code:

    CBrush brush;
    if (!brush.CreateBrushIndirect(&m_logbrush))
    return;
    CPen pen;
    if (!pen.CreatePenIndirect(&m_logpen))
    return;

    CBrush* pOldBrush;
    CPen* pOldPen;

    if (m_bBrush)
    pOldBrush = pDC->SelectObject(&brush);
    else
    pOldBrush = (CBrush*)pDC->SelectStockObject(NULL_BRUSH);

    if (m_bPen)
    pOldPen = pDC->SelectObject(&pen);
    else
    pOldPen = (CPen*)pDC->SelectStockObject(NULL_PEN);

    CRect rect = BoundingRect();
    pView->DocToClient(rect) ;

    int iBkMode = pDC->SetBkMode (TRANSPARENT);
    int ropMode = pDC->SetROP2(R2_COPYPEN) ;

    CPoint* l_pPoints ;
    switch (m_nShape)
    {
    case rectangle:
    pDC->Rectangle(rect);
    break;

    case ellipse:
    pDC->Ellipse(rect);
    break;
    }

    pDC->SetBkMode (iBkMode) ;

    pDC->SetROP2(ropMode) ;

    pDC->SelectObject(pOldBrush);
    pDC->SelectObject(pOldPen);
    }



    I know it works but again on some computers the background becomes white.
    When I checked it in debug mode, all the values appeared normal.

    Thanks again,

    xnxn

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