zoukankan      html  css  js  c++  java
  • 窗口重绘

    Windows程序运行时,如果程序窗口大小发生变化,窗口会发生重绘,窗口中已输入的文字或图像就会被擦除。如果希望输入的内容始终保留在窗口上,就要在响应WM_PAINT消息的函数中将内容再次输出。在MFCAppWizard的视图窗口中提供了类似于WM_PAINT消息响应函数的OnDraw函数,当窗口发生重绘时,应用程序框架代码就会调用该函数。  

      OnDraw函数:

      void CTextView::OnDraw(CDC* pDC)

      {

        CTextDoc* pDoc = GetDocument();

        ASSERT_VALID(pDoc);

        // TODO: add draw code for native data here

      }

      添加字符串资源:

      

      

      例: 

    void CTextView::OnDraw(CDC* pDC)
    {
        CTextDoc* pDoc = GetDocument();
        ASSERT_VALID(pDoc);
        // TODO: add draw code for native data here
        CString str1;
        str1="hello";
        CString str2;
        str2="MFC";
        CString str;
        str=str1+str2;
        pDC->TextOut(100,100,str);
    
        str.LoadString(IDS_STRING);
        pDC->TextOut(200,200,str);
    }
    
  • 相关阅读:
    vue
    vim 使用
    ssh 免密码登录
    shell 监控
    shell top
    使用网络技术---WebView
    安卓数据存储
    模块
    面向对象
    文件
  • 原文地址:https://www.cnblogs.com/zhouwanqiu/p/6916055.html
Copyright © 2011-2022 走看看