基本信息
源码名称:wpf webbrowser 不显示 冲突问题解决方案
源码大小:0.04M
文件格式:.zip
开发语言:C#
更新时间:2016-03-08
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WebBrowserOnTransparentWindow
{
    /// <summary>
    /// Window visually hosting a web browser control; using transparency
    /// </summary>
    public partial class Window1 : Window
    {
        public Window1(): this(OverlayStyle.WinForms)
        {
        }
        public Window1(OverlayStyle style)
        {
            InitializeComponent();

            if (style == OverlayStyle.WPF)
            {
                WebBrowserOverlay wbo = new WebBrowserOverlay(_webBrowserPlacementTarget);
                WebBrowser wb = wbo.WebBrowser;
                wb.Navigate(new Uri("http://live.com"));

                _showOtherButton.Content = "Show WinForms-based overlay";
            }
            else if (style == OverlayStyle.WinForms)
            {
                WebBrowserOverlayWF wbo = new WebBrowserOverlayWF(_webBrowserPlacementTarget);
                System.Windows.Forms.WebBrowser wb = wbo.WebBrowser;
                wb.Navigate(new Uri("http://live.com"));

                _showOtherButton.Content = "Show WPF-based overlay";
            }

            _showOtherButton.Click  = delegate
            {
                new Window1(style == OverlayStyle.WinForms ? OverlayStyle.WPF : OverlayStyle.WinForms).Show();                
            };
        }

        public enum OverlayStyle { 
            WPF, // Can't use opacity.
            WinForms // Flicker on resize when opacity is used without DWM composition
        };

        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            if (e.LeftButton == MouseButtonState.Pressed &&
                // For some reason Slider doesn't seem to mark MouseMove events as handled.
                VisualTreeHelper.HitTest(_opacitySlider, e.GetPosition(_opacitySlider)) == null)
            {
                DragMove();
            }
        }
    }
}