问题1:嵌套Winform控件(ZedGraph)在WPF的ScrollViewer控件上,出现滚动条,无论如何设置该Winform控件都在顶层,滚动滚动条会覆盖其他WPF控件。

解决办法:在ScrollViewer上嵌套一层ElementHost,其作用相当于将ScrollViewer整一层又包装成Winform。
          <wfi:WindowsFormsHost><wfi:ElementHost><ScrollViewer />                 </wfi:ElementHost></wfi:WindowsFormsHost>

如: 
<UserControl x:Class="AnesMS.TakeManage.AnesPrintView"
             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"
             xmlns:wfi ="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
             xmlns:wf ="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
             xmlns:zedgraph="clr-namespace:ZedGraph;assembly=ZedGraph"
             xmlns:GraphCtrl="clr-namespace:DIH.ORIMS.GraphControl;assembly=DIH.ORIMS.GraphControl"
             mc:Ignorable="d"
             x:Name="UserControl"
             d:DesignHeight="550" d:DesignWidth="1250">

<Grid Width="1024" Height="650">
        <Grid.RowDefinitions>
            <RowDefinition Height="40" />
            <RowDefinition Height="*" />
            <RowDefinition Height="50" />
        </Grid.RowDefinitions>
        <Label Content="打印预览" Style="{StaticResource PopBannerStyle}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
        <wfi:WindowsFormsHost Grid.Row="1">
            <wfi:ElementHost>
                <ScrollViewer Grid.Row="1" Panel.ZIndex="0">

                    <wfi:WindowsFormsHost x:Name="winFormPrint" Width="760" Height="1080" Panel.ZIndex="-1">
                        <GraphCtrl:GraphCtrl x:Name="graphCtrl"  />
                    </wfi:WindowsFormsHost>
                </ScrollViewer>
            </wfi:ElementHost>
        </wfi:WindowsFormsHost>
        <StackPanel Orientation="Horizontal" Grid.Row="2">
            <Button Command="{Binding CancelCommand}" Style="{StaticResource LightGreenButton}" Content="关闭" HorizontalAlignment="Right" Margin="0,0,20,0" Name="button1" VerticalAlignment="Bottom" Width="75" Grid.Row="1" Height="37" />
            <Button IsEnabled="False" Content="打印" Height="37" HorizontalAlignment="Right" Margin="0,0,0,0" Name="button2" Style="{StaticResource LightGreenButton}" VerticalAlignment="Bottom" Width="75" Grid.Row="1" />
        </StackPanel>
    </Grid> 
</UserControl> 

wpf里窗体嵌入winform控件被覆盖问题的更多相关文章

  1. WPF 嵌入winform 控件

    引入 WindowsFormsIntegration.dll   和   System.Windows.Forms.dll <Window x:Class="wgscd.Window1 ...

  2. WPF中不规则窗体与WindowsFormsHost控件的兼容问题完美解决方案

    首先先得瑟一下,有关WPF中不规则窗体与WindowsFormsHost控件不兼容的问题,网上给出的解决方案不能满足所有的情况,是有特定条件的,比如  WPF中不规则窗体与WebBrowser控件的兼 ...

  3. Wpf使用Winform控件后Wpf元素被Winform控件遮盖问题的解决

    有人会说不建议Wpf中使用Winform控件,有人会说建议使用Winform控件在Wpf下的替代方案,然而在实际工作中由于项目的特殊需求,考虑到时间.成本等因素,往往难免会碰到在WPF中使用Winfr ...

  4. 《Dotnet9》系列-开源C# Winform控件库1《HZHControls》强力推荐

    大家好,我是Dotnet9小编,一个从事dotnet开发8年+的程序员.我最近在写dotnet分享文章,希望能让更多人看到dotnet的发展,了解更多dotnet技术,帮助dotnet程序员应用dot ...

  5. WPF中不规则窗体与WebBrowser控件的兼容问题解决办法

    原文:WPF中不规则窗体与WebBrowser控件的兼容问题解决办法 引言 这几天受委托开发一个网络电视项目,要求初步先使用内嵌网页形式实现视频播放和选单,以后再考虑将网页中的所有功能整合进桌面程序. ...

  6. 在WPF中使用WinForm控件方法

    1.      首先添加对如下两个dll文件的引用:WindowsFormsIntegration.dll,System.Windows.Forms.dll. 2.      在要使用WinForm控 ...

  7. 通过WinForm控件创建的WPF控件无法输入的问题

    今天把写的一个WPF程序发布到别的机器上执行,发现一个比较奇怪的问题:在那个机器上用英文输入法无法输入数字,非要切换到中文输入法才行:但在我的机器上却是好好的. 最开始以为是输入法的问题,弄了好一阵子 ...

  8. [转]在WPF中使用WinForm控件方法

    本文转自:http://blog.csdn.net/lianchangshuai/article/details/6415241 下面以在Wpf中添加ZedGraph(用于创建任意数据的二维线型.条型 ...

  9. WPF保存包含Winform控件的XAML页面问题

    原文:WPF保存包含Winform控件的XAML页面问题 最近的工作中,用到了WPF调用Winform控件 但是在保存XAML页面的时候发现了问题,就是Winform页面黑黑的,没有任何渲染的波形曲线 ...

随机推荐

  1. java文件生成

    package com.gcy.test.util; import java.io.BufferedWriter; import java.io.File; import java.io.FileNo ...

  2. MSF渗透测试-CVE-2017-11882(MSOffice漏洞)

    1.测试环境 2.测试前准备 3.测试过程 -3.1虚拟机环境测试 -3.2局域网靶机测试 4.测试感想 1.测试环境 攻击机: OS:kail IP:192.168.15.132/192.168.1 ...

  3. AppiumDriverLocalService 启动appium控制台不显示日志以及把日志保存到本地

    import java.io.File; import java.io.OutputStream; import java.lang.reflect.Field; import java.util.A ...

  4. Linux基础命令---chmod

    chmod 改变文件或者目录的权限,可以用数字或者字母来标识权限.在数字模式下:0,代表没有权限:1,代表可执行:2,代表可读:4,代表可写:多个权限可以相加.在字符模式下:x,代表执行:r,代表读: ...

  5. ACM题目————A Knight's Journey

    Description BackgroundThe knight is getting bored of seeing the same black and white squares again a ...

  6. Android LCD(二):LCD常用接口原理篇(转)

    源: Android LCD(二):LCD常用接口原理篇

  7. 根据wsdl,apache cxf的wsdl2java工具生成客户端、服务端代码

    根据wsdl,apache cxf的wsdl2java工具生成客户端.服务端代码 apache cxf的wsdl2java工具的简单使用: 使用步骤如下: 一.下载apache cxf的包,如apac ...

  8. trace

    linux 下程序的系统调用和信号调用跟踪工具 http://www.cnblogs.com/qingquan/archive/2011/07/18/2110072.html

  9. Linux系统编程--文件描述符的复制dup()和dup2()【转】

    本文转载自:http://blog.csdn.net/tennysonsky/article/details/45870459 dup() 和 dup2() 是两个非常有用的系统调用,都是用来复制一个 ...

  10. 启动jenkins服务错误

    背景 重新安装了jenkins,需要启动,使用的yum install安装的,启动jenkins的话只需要执行service jenkins start,但出了两个问题 1. 是提示找不到java 2 ...