1.字处理所使用的插入符用法
CreateSolidCare函数中两个参数任意一个为0,另一个参数值则为系统默认的值。
nWidthSpecifies the width of the caret (in logical units). If this parameter is 0, the width is set to the system-defined window-border width.
-
nHeight
-
Specifies the height of the caret (in logical units). If this parameter is 0, the height is set to the system-defined window-border height.
-
(读者可以通过GetSystemMetrics函数获得系统默认值) CreateSolidCare(10, 20);创建之后就会自动隐藏,必须显示的调用
ShowCaret();显示的调用。 msdn中的函数原型如下:-
lpMetrics
-
Points to the
TEXTMETRIC structure that receives the metrics.
所以要构造一个 TEXTMETRIC的结构体。经过此操作,光标的大小和长度正常。
2.图形的插入符现在全局定义一个CBitMap的对象,CBitMap map;int CtextView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1; // TODO: 在此添加您专用的创建代码
CClientDC dc(this);
map.LoadBitmap(IDB_BITMAP1); CreateCaret(&map);
ShowCaret();
return 0;
} -