找传奇、传世资源到传世资源站!

winform使用miniblink展示html(全屏)

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

使用miniblink 展示html的例子,miniblink基于chromium的浏览器控件
点击下图中的百度,即可 实现全屏访问 百度网页 ,如下图:

from clipboardfrom clipboard
其实是winform嵌入的这个网页,打开即是 全屏效果from clipboard
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.IO;using Kyozy.MiniblinkNet;namespace ShowPage{ public partial class Index : Form { private WebView m_wke; private string path = ""; public Index() { m_wke = new WebView(); InitializeComponent(); try { string config = ReadTxt(System.AppDomain.CurrentDomain.BaseDirectory "html\\config.txt"); this.StartPosition = FormStartPosition.Manual; this.FormBorderStyle = FormBorderStyle.None; this.Location = new Point(Convert.ToInt32(config.Split('|')[0]), Convert.ToInt32(config.Split('|')[1])); this.Size = new System.Drawing.Size(Convert.ToInt32(config.Split('|')[2]), Convert.ToInt32(config.Split('|')[3])); path = System.AppDomain.CurrentDomain.BaseDirectory "html\\" config.Split('|')[4] "\\" config.Split('|')[5] ".html"; } catch { } } /// <summary> /// 读取txt文件 /// </summary> /// <param name="path"></param> /// <returns></returns> public string ReadTxt(string path) { try { if (File.Exists(path)) { StringBuilder sb = new StringBuilder(); StreamReader sr = new StreamReader(path, Encoding.Default); String line; while ((line = sr.ReadLine()) != null) { sb.Append(line.ToString()); } sr.Dispose(); return sb.ToString(); } else { return ""; } } catch { return ""; } } private void Index_Load(object sender, EventArgs e) { if (!m_wke.Bind(this)) { return; } m_wke.NavigationToNewWindowEnable = false; m_wke.CookieEnabled = false; JsValue.BindFunction("FormClose", new wkeJsNativeFunction(formClose), 0); JsValue.BindFunction("FormReload", new wkeJsNativeFunction(wkeReload), 0); m_wke.Load(path); } long formClose(IntPtr es, IntPtr param) { System.Environment.Exit(0); return JsValue.UndefinedValue(); } long wkeReload(IntPtr es, IntPtr param) { m_wke.Reload(); return JsValue.UndefinedValue(); } }}

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复