次の方法で共有


CWnd::SetCaretPos

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

static void PASCAL SetCaretPos(
   POINT point 
);

パラメーター

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

解説

SetCaretPos メンバー関数は、カレットが現在のタスクのウィンドウによって所有されている場合だけ、カレットを移動します。 SetCaretPos は、カレットが非表示かどうかにかかわらずカレットを移動します。

カレットは共有リソースです。 CWnd がカレットを所有していない場合は、ウィンドウは移動できません。

使用例

// 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

概念

CWnd のメンバー