Share via


CWnd::SetCaretPos

キャレットの位置を設定します。

static void PASCAL SetCaretPos( 
   POINT point  
);

パラメーター

  • point
    キャレットの新しい x と y 座標 (クライアント座標) を指定します。

解説

SetCaretPos のメンバー関数は、現在のタスク ウィンドウが所有している場合にのみキャレットを移動します。 SetCaretPos は、キャレットが非表示かどうかキャレットを移動します。

キャレットは共有リソースです。 ウィンドウは、キャレットの所有者キャレットを移動しないでください。

使用例

// The following code snippet shows a caret when the left  
// mouse button is pressed, and sets the caret's positon to  
// the cursor's position. 
void CMyView::OnLButtonDown(UINT nFlags, CPoint point) 
{
   //create a solid caret, the width is 2, the length is 20.
   CreateSolidCaret(2, 20);

   SetCaretPos(point);
   ShowCaret();

   CView::OnLButtonDown(nFlags, point);
}

必要条件

ヘッダー: afxwin.h

参照

関連項目

CWnd クラス

階層図

CWnd::GetCaretPos

SetCaretPos