插入符

来源:互联网 发布:lastindexof js 编辑:程序博客网 时间:2024/05/16 05:26

      1.在正常的文本编辑器里面都有一个文本插入符,那么如何在mfc里面实现文本插入符呢。。可以在view类中添加消息处理函数,oncreat(),再窗口创建的时候创建插入符。。主要函数是CreatSolidCaret(int 宽度,int高度)。。。。可以根据不同的字体来创建不同的文本插入符。。获取文本信息可以用GetTextMetrics(LPTEXTMETRIC lpMetrics ),需要定义一个LPTEXTMETRIC型的变量来存储文本信息。。。如果是要获取一个字符串的高度和长度就必须用另外一个函数,CSize GetTextExtent(
   LPCTSTR lpszString,
   int nCount
) const;来获取。。。主要区别GetTextMetrics和GetTextExtent函数的差别。。。

     2.为了那窗口的某个部分和其他部分有差别,可以用创建路径层的方法,然后再和函数SelectClipPath 搭配就能取得一些想要的效果。。。

方法有:

   

nMode

Specifies the way to use the path. The following values are allowed:

  • RGN_AND   The new clipping region includes the intersection (overlapping areas) of the current clipping region and the current path.

  • RGN_COPY   The new clipping region is the current path.

  • RGN_DIFF   The new clipping region includes the areas of the current clipping region, and those of the current path are excluded.

  • RGN_OR   The new clipping region includes the union (combined areas) of the current clipping region and the current path.

  • RGN_XOR   The new clipping region includes the union of the current clipping region and the current path, but without the overlapping areas.

  • 创建路径层可以用beingpath和endpath方法。。。

原创粉丝点击