1

解決策 はこちら

WPF ウィンドウを使用して Windows フォームのコンテキスト メニューをエミュレートするように依頼されました。ユーザーが特定の領域をクリックしたときにウィンドウを作成しましたが、そのウィンドウはすぐにタスク バーに最小化されました。少なくともフォーカスを失うか非アクティブ化されるまで、他のウィンドウの上にとどまる必要があります。そのウィンドウ スタイルは none であり、show in taskbar プロパティが true であるか false であるかは関係ありません。SOにも同様の質問がありますが、私の場合は何も解決しないようです。なぜこの奇妙な行動?それに対する修正はありますか?

<Window x:Class="InterceptRouteWindow"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"  Width="200" ResizeMode="NoResize" SizeToContent="Height" ShowInTaskbar="False" Loaded="Window_Loaded" WindowStyle="None" Height="auto" Deactivated="Window_Deactivated">


        <StackPanel Height="auto" Name="stackPanel1" Width="200" Background="WhiteSmoke">
             <Separator Height="5"  FlowDirection="LeftToRight">
               <Separator.Background>
                 <SolidColorBrush />
               </Separator.Background>
            </Separator>
      </StackPanel>
</Window>

なので、シンプルな窓です。私がそれを呼び出す方法:

 IRWindow = gcnew InterceptRouteWindow(routes, fpId, offsetPoint.x, offsetPoint.y);
 GetMainFrame()->IRWindow->Show();

これは、MFC と WindowsForms が混在する古いアプリ内のクリック イベントによってトリガーされます。私のコードではありません。設計に従い、可能な限り WPF を使用する必要がありました。

4

0 に答える 0