问题如题

解决方案 »

  1.   

    为什么要在这里画?如果一定要这样,先画到一个内存DC上,然后Onpaint中copy一下
      

  2.   

    dialog 上有一个picture   control,
    picture   control,属性为bitmap,
    要在这个bmp上写字, 然后要在 OnInitDialog(),return ture 之后,即对话框显示出来的时候,文字要能显示出来
      

  3.   

    还是去OnPaint做吧。 你这个思路不对。即使是你写上去字了,重绘的时候也要在OnPaint上作画。
      

  4.   

    void CxxxDlg::OnPaint() 
    {
    CPaintDC dc(this); // device context for painting

    // TODO: Add your message handler code here CString strdemo;
    strdemo.Format(_T("AAAAAAAAAAAAA"));
    dc.DrawText(strdemo,CRect(0,0,50,50),DT_CENTER);

    // Do not call CDialog::OnPaint() for painting messages
    }
    没反应呢?
      

  5.   

    void CEAGEDlg::OnPaint()
    {
    if (IsIconic())
    {
    CPaintDC dc(this); // device context for painting SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0); // Center icon in client rectangle
    int cxIcon = GetSystemMetrics(SM_CXICON);
    int cyIcon = GetSystemMetrics(SM_CYICON);
    CRect rect;
    GetClientRect(&rect);
    int x = (rect.Width() - cxIcon + 1) / 2;
    int y = (rect.Height() - cyIcon + 1) / 2; // Draw the icon
    dc.DrawIcon(x, y, m_hIcon);
    }
    else
    {
    CPaintDC dc(this); // device context for painting // TODO: Add your message handler code here CString strdemo;
    strdemo.Format(_T("AAAAAAAAAAAAA"));
    dc.DrawText(strdemo,CRect(0,0,50,50),DT_CENTER|DT_CENTER);  CDialog::OnPaint();
    }
    }
      

  6.   

    OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)   里面可以做不得到写字后的 HBRUSH hbr
    然后 ,return
    ???????????????
      

  7.   


    你把CDialog::OnPaint();给注释掉了,加上。
      

  8.   

              ---你把CDialog::OnPaint();给注释掉了,加上。---
    本来就没有!
    添加WM_PAINT后就是
    void CxxxDlg::OnPaint() 

    CPaintDC dc(this); // device context for painting // TODO: Add your message handler code here // Do not call CDialog::OnPaint() for painting messages 

    不过我加上 CDialog::OnPaint();后 也是没有反应!
      

  9.   

    多余代码 CDialog::OnPaint(); 
      

  10.   

    回到主题:dialog 上有一个picture  control, picture  control属性为bitmap, 
    要在OnInitDialog()中给这个picture control写上字, 然后要在 OnInitDialog(),return ture 之后,即对话框显示出来的时候,文字要能显示出来怎么做?
      

  11.   

    如果你要移动对话框字也不消失的话,必须在ondraw中做写字的操作,否则文字会因为重绘而消失
      

  12.   

    直接得到picture control的DC然后 写字,这在OnInitDialog(),之后是可以的,但在OnInitDialog()函数内部写字,在dialog 真正显示出来的时候,文字是不会出现的!