ElementHost的WPF中的WinForms崩溃(Windows)中最大化时 [英] WPF ElementHost in Winforms crashes (Windows) when Maximized

查看:486
本文介绍了ElementHost的WPF中的WinForms崩溃(Windows)中最大化时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想一个新的WPF控件集成到现有的WinForms应用程序,我使用的是ElementHost的(码头 - 填充)主办的下面的XAML用户控件。 (.NET 4)

I'm trying to integrate a new WPF control into an existing WinForms application and I'm using an ElementHost(Dock-Fill) to host the following XAML UserControl. (.NET 4)

当我设置winform中Maximised我的整个操作系统崩溃。我已经更新到了我的显卡最新的Nvidia驱动程序,但我还是结束了在nvlddmkm.sys蓝屏。我已经搜索周围其他人遇到这样的事故,但没有发现任何非更新显卡驱动程序。

When I set the WinForm to Maximised my entire operating system crashes. I have updated to the latest NVidia Drivers for my video card, but I still end up with a BlueScreen in nvlddmkm.sys. I have searched around for others that are experiencing crashes like this, but haven't found anything other than "update video card drivers".

在该用户指定的CustomerOrderReadyControl是在C#中,但由于它只是显示我没有把它列入了消息的基本用户控件,但如果你认为我应该,请在意见栏内注明。

The CustomerOrderReadyControl specified in the UserControl is in C#, but given it's just a basic UserControl that displays the Message I haven't included it, but if you think I should, please specify in the comments.

有没有办法,我失踪,可能是导致我的应用程序会导致当我最大限度的表格机器以蓝屏的设置? 是否有任何其他的方式,我可以做这种情况下工作,考虑到现有的应用程序是非常沉重的GDI +的应用?

Is there a setting that I am missing that could be causing my Application to be causing the Machine to bluescreen when I maximise the Form? Are there any other ways that I could make this scenario work given that the existing application is very heavy GDI+ for the rendering of other parts of the application?

<UserControl x:Class="WPFDisplay.CustomerOrderDisplayControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    mc:Ignorable="d" 
    d:DesignHeight="480" d:DesignWidth="640" xmlns:my="clr-namespace:WPFDisplay">
    <UserControl.Background>
        <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
            <GradientStop Color="#FFEEEEEE" Offset="0.05"/>
            <GradientStop Color="#FF333333" Offset="0.95"/>
        </LinearGradientBrush>
    </UserControl.Background>
        <Grid Name="mainGrid">

        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition  Name="imageRow" Height="125" />
        </Grid.RowDefinitions>

        <my:CustomerOrderReadyControl Grid.Row="0"  x:Name="customerOrderReadyControl1" 
               Message="The Message" />
        <Image Margin="0,0,6,7" Name="displayLogo" Grid.Row="1" VerticalAlignment="Bottom" 
               HorizontalAlignment="Right" Width="302" Height="107" Stretch="None" IsHitTestVisible="False" />
    </Grid>
</UserControl>

在InitializeComponent子在我的WinForms真的是这么简单。

The InitializeComponent sub in my WinForms is really this simple.

Private Sub InitializeComponent()
    Me.ElementHost1 = New System.Windows.Forms.Integration.ElementHost()
    Me.CustomerOrderDisplayControl1 = New WPFDisplay.CustomerOrderDisplayControl()
    Me.SuspendLayout()
    '
    'ElementHost1
    '
    Me.ElementHost1.Dock = System.Windows.Forms.DockStyle.Fill
    Me.ElementHost1.Location = New System.Drawing.Point(0, 0)
    Me.ElementHost1.Name = "ElementHost1"
    Me.ElementHost1.Size = New System.Drawing.Size(1058, 617)
    Me.ElementHost1.TabIndex = 0
    Me.ElementHost1.Text = "ElementHost1"
    Me.ElementHost1.Child = Me.CustomerOrderDisplayControl1
    '
    'CustomerOrderDisplayForm
    '
    Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
    Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
    Me.ClientSize = New System.Drawing.Size(1058, 617)
    Me.Controls.Add(Me.ElementHost1)
    Me.Name = "CustomerOrderDisplayForm"
    Me.Text = "CustomerOrderDisplayForm"
    Me.ResumeLayout(False)

End Sub

编辑: 附加信息。如果我主持这控制在纯WPF应用程序,最大限度地提高了WPF的形​​式,那么这一切工作正常。

Additional info.. If I host this control in a Pure WPF application and maximise the WPF Form, then it all works fine.

推荐答案

原来,这是显卡(NVIDIA NVS295)只是没有处理WPF操作。它结束了没有无所谓它是否是在一个完全成熟的WPF应用程序或嵌入在一个ElementHost的,如果屏幕显示全屏幕(1900x1200的),然后机器bluescreened。

Turns out this was the video card (NVidia NVS295) just not handling the WPF operations. It ended up not mattering whether it was in a full blown WPF application or embedded inside an ElementHost if the screen display full screen (1900x1200) then the machine bluescreened.

这篇关于ElementHost的WPF中的WinForms崩溃(Windows)中最大化时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆