wpf cefsharp html源码,c# – 不显示或呈现CefSharp WPF Web浏览器

是CefSharp的新手

我创建了一个类库项目并引用了CefSharp库来呈现Web浏览器,但是我面临一些显示Web浏览器的问题.请找到确切的代码

WebBrowser_test1:

public partial class ChildWidget : Window

{

public CefSharp.Wpf.ChromiumWebBrowser webView;

public Widget()

{

InitializeComponent();

CefSharp.CefSettings settings = new CefSharp.CefSettings();

settings.PackLoadingDisabled = true;

if (CefSharp.Cef.Initialize(settings))

{

webView = new CefSharp.Wpf.ChromiumWebBrowser();

main_grid.Children.Add(webView);

webView.Address = "http://www.google.co.uk";

}

}

}

我在另一个项目中引用这个库(dll)

public MainWindow()

{

InitializeComponent();

Button newbutton = new Button();

newbutton.Width = 50;

main_grid.Children.Add(newbutton);

newbutton.Click += ButtonClick;

}

private void ButtonClick(object sender, RoutedEventArgs e)

{

try

{

Webbrowser_test1.ChildWidget childWidget = new Widget();

childWidget.Show();

}

catch (Exception)

{

throw;

}

}

现在点击按钮,我将打开(WebBrowser_test1)子窗口小部件,我将在其中显示Web浏览器..当窗口打开时,它显示为空白.

如果我遗漏任何东西,请告诉我

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值