把edit的dc设了透明后,输入字符会出现重影现象,这是怎么回事?
是用atl作的,代码如下: 
LRESULT CAddTextDialog::OnCtlColorEdit(UINT , WPARAM , LPARAM , BOOL& )
{
 
        SetBkMode((HDC)wParam, TRANSPARENT);   
return 0;
}是不是有些默认的操作没做啊?

解决方案 »

  1.   

    return  (HBRUSH)GetStockObject(HOLLOW_BRUSH);
      

  2.   

    HBRUSH CZilchDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
    {
      // Call the base class implementation first! Otherwise, it may
      // undo what we are trying to accomplish here.
      HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);  // Are we painting the IDC_MYSTATIC control? We can use
      // CWnd::GetDlgCtrlID() to perform the most efficient test.
      if (pWnd->GetDlgCtrlID() == IDC_MYSTATIC)
      {
        // Set the background mode for text to transparent
        // so background will show thru.
        pDC->SetBkMode(TRANSPARENT);    // Return handle to our CBrush object.
        hbr = (HBRUSH)GetStockObject(HOLLOW_BRUSH);;
      }  return hbr;
    }
      

  3.   

    //这样才对
        pDC->SetBkMode(TRANSPARENT);
        hbr = (HBRUSH)GetStockObject(HOLLOW_BRUSH);;
      

  4.   

    An edit control that is not read-only or disabled sends the WM_CTLCOLOREDIT message to its parent window when the control is about to be drawn. By responding to this message, the parent window can use the specified device context handle to set the text and background colors of the edit control. Rich Edit: This message is not supported. To set the background color for a rich edit control, use the EM_SETBKGNDCOLOR message.