System.Windows.Controls.PrintDialog を使用する WPF UserControl があります。
XAML:
<UserControl x:Class="WpfControlLibrary1.UserControl1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Button Click="Button_Click"/>
</UserControl>
分離コード:
namespace WpfControlLibrary1
{
using System.Windows;
using System.Windows.Controls;
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
var printer = new PrintDialog();
printer.ShowDialog();
}
}
}
この UserControl を WPF アプリケーションで使用すると、PrintDialog-Windows がモーダル ダイアログとして表示されます。(msdnで説明されているように)
しかし、Wondows-Forms アプリケーションで UserControl を使用すると、ダイアログは非モーダル ダイアログとして表示されます。
Windowsフォームアプリケーションでユーザーコントロールをホストするときに、PrintDialogをモーダルダイアログとして呼び出す方法を知っている人はいますか?
期待していただきありがとうございますrhe1980