![](/img/trans.png)
[英]printdialog.showdialog(); not showing the print dialog in windows 7 with 64 bit
[英]Call PrintDialog.ShowDialog() in a WPF UserControl which is hosted in WinForms Application
我有一個WPF UserControl,它使用System.Windows.Controls.PrintDialog:
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();
}
}
}
如果現在在WPF應用程序中使用此UserControl,則PrintDialog-Windows將顯示為模式對話框。 (如msdn中所述)
但是,如果我在Wondows-Forms應用程序中使用UserControl,則該對話框顯示為非模態對話框。
有誰知道將用戶控件托管在Windows Forms應用程序中時如何調用PrintDialog作為模式對話框?
感謝您對rhe1980的期待
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.