パッケージにいくつかのツール ウィンドウがあり、ユーザーがツール ウィンドウで何らかのアクションを実行したときに、ドキュメント内の特定のポイントを表示したいと考えています。
私は次のコードを試しました:
// Perform selection
TextSelection selection = activeDocument.Selection as TextSelection;
selection.MoveToAbsoluteOffset(offset, false);
// Show the currently selected line at the top of the editor if possible
TextPoint tp = (TextPoint)selection.TopPoint;
tp.TryToShow(vsPaneShowHow.vsPaneShowTop, null);
やりたいことはできますが、残念ながら、Visual Studio コード エディターにフォーカスが移ってしまい、ツール ウィンドウから離れてしまいます。ユーザーがツール ウィンドウに入力していて、突然エディターにフォーカスが移動した場合、これは適切ではありません。
フォーカスを失わずにこれを行う別の方法はありますか?