文書番号: 108434
最終更新日: 2004/01/23
if (pOldActiveView == pParent->GetActiveView()) { pParent->SetActiveView(pOldActiveView); // Re-activate. if (pOldActiveView != NULL) pOldActiveView->SetFocus(); // Make sure focus is restored. }WINSPLIT.CPP に実装されている CSplitterWnd::StopTracking を修正し、『クラス ライブラリ ユーザーズ ガイド』の付録 B 、またはより詳細に記述されている \MSVC\MFC\SRC\README.TXT に従い MFC のライブラリを再構築してください。
class CMySplit:public CSplitterWnd // derive from it. { public: // This is the pointer to the window that // has focus when the splitter starts resizing. HWND hWndFocus; // ...rest of your declaration. } void CMySplit::OnLButtonDown(UINT nFlags, CPoint point) { //Get CWnd with current focus hWndFocus = ::GetFocus(); // Remember to call the base class handler. CSplitterWnd::OnLButtonDown(nFlags,point); } void CMySplit::OnLButtonUp(UINT nFlags, CPoint point) { //restore focus ::SetFocus(hWndFocus); // Remember to call the base class handler. CSplitterWnd::OnLButtonUp(nFlags,point); }このコードでは、OnLButtonDown() ハンドラが呼ばれる前に分割ウィンドウのどれかにフォーカスが設定されると仮定しています。すなわち、マウス ボタンが離されたとき分割ウィンドウ外のウィンドウにフォーカスがセットされることは望まれないでしょう。処理後にフォーカスが分割ウィンドウにセットされるかどうか確認するには、フレーム ウィンドウのメンバ変数 m_pActiveView をチェックするコードを追加します。
Additional query words: 1.00 2.00 2.10 splitter focus kbNoUpdate
Keywords: 2.00 2.10 VC10 VC15 KB108434
Technology: kbAudDeveloper kbMFC kbvc100 kbVC16bitSearch kbVC32bitSearch kbVCsearch