基本信息
源码名称:winform使用miniblink展示html(全屏)
源码大小:5.48M
文件格式:.rar
开发语言:C#
更新时间:2019-08-06
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

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

本次赞助数额为: 2 元 
   源码介绍
使用miniblink 展示html的例子,miniblink基于chromium的浏览器控件

点击下图中的百度,即可 实现全屏访问 百度网页 ,如下图:




其实是winform嵌入的这个网页,打开即是 全屏效果


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();
        }
    }
}