首页 > C/C++开发工具专区 > VC技术 > MFC文本编程:创建插入符
2010
01-26

MFC文本编程:创建插入符

MFC文本编程:创建插入符




一、创建文本插入符


Step01、创建插入符


相关函数/结构体
            CWnd::CreateSolidCaret(); 
             定义:void CreateSolidCaret(int nWidth,int nHeight);
        在View类中加入WM_CREATE消息的响应函数OnCreate,加入CreateSolidCaret()
        效果:没有显示插入符呀!   



QUOTE FROM MSDN
The CreateSolidCaret method automatically destroys the previous caret shape, if any, regardless of which window owns the caret. Once created, the caret is initially hidden. To show the caret, the ShowCaret method must be called.


Step02、显示插入符


        加上ShowCaret();
    Step03、让插入符跟字体大小相关
        相关函数/结构体:
            获取字符信息CDC::GetTextMetrics
            字符属性结构体TEXTMETRIC Structure


code


MFC文本编程:创建插入符》有 1 条评论

  1. coolker 说:

    MFC文本编程:创建插入符

    一、创建文本插入符

    Step01、创建插入符

    相关函数/结构体
                CWnd::CreateSolidCaret(); 
                 定义:void CreateSolidCaret(int nWidth,int nHeight);
            在View类中加入WM_CREATE消息的响应函数OnCreate,加入CreateSolidCaret()
            效果:没有显示插入符呀!   

    QUOTE FROM MSDN
    The CreateSolidCaret method automatically destroys the previous caret shape, if any, regardless of which window owns the caret. Once created, the caret is initially hidden. To show the caret, the ShowCaret method must be called.

    Step02、显示插入符

            加上ShowCaret();
        Step03、让插入符跟字体大小相关
            相关函数/结构体:
                获取字符信息CDC::GetTextMetrics
                字符属性结构体TEXTMETRIC Structure

    http://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif','Image‘);” onmouseover=”this.style.cursor=’hand’” onmouseout=”this.style.cursor=”” src=”http://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif” border=”0″ />http://images.cnblogs.com/OutliningIndicators/ExpandedBlockStart.gif','Image‘);” onmouseover=”this.style.cursor=’hand’” onmouseout=”this.style.cursor=”” src=”http://images.cnblogs.com/OutliningIndicators/ExpandedBlockStart.gif” border=”0″ />code

留下一个回复