欢迎来到传世资源网!
加载中...
正在加载,请耐心等待...
本站为收藏、学习站,如有侵权,请联系管理员删除!

winform嵌入谷歌浏览器

介绍 评论 失效链接反馈

from clipboard
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;using System.Web;using CefSharp;using CefSharp.WinForms;using YjiaLife.Utils;using System.Configuration;namespace YjiaLife{ public partial class Form1 : Form { //BardCodeHooK BarCode = new BardCodeHooK(); private ScanerHook listener = new ScanerHook(); //string value = ""; //value为扫码枪获取的内容,以Enter结尾 //private delegate void ShowInfoDelegate(BardCodeHooK.BarCodes barCode); public Form1() { InitializeComponent(); } public ChromiumWebBrowser browser; [Obsolete] public void InitBrowser() { InitializeComponent(); this.MaximizeBox = false; this.MinimizeBox = false; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; string url = ConfigurationSettings.AppSettings["url"].ToString(); int wide = Convert.ToInt32(ConfigurationSettings.AppSettings["wide"].ToString()); int high = Convert.ToInt32(ConfigurationSettings.AppSettings["high"].ToString()); //string url = "https://m.1jingxi.com/surpriseplus/jump"; ChromiumWebBrowser webview = new ChromiumWebBrowser(url); webview.Dock = DockStyle.Fill; webview.Width = wide; webview.Height = high; webview.ConsoleMessage = OnConsoleMessage; webview.StatusMessage = OnBrowserStatusMessage; CefSharpSettings.LegacyJavascriptBindingEnabled = true; webview.JavascriptObjectRepository.Register("JsObject", new Class1(), false, BindingOptions.DefaultBinder); webview.KeyboardHandler = new CEFKeyBoardHander(); this.Controls.Add(webview); //BarCode.BarCodeEvent = new BardCodeHooK.BardCodeDeletegate(BarCode_BarCodeEvent); listener.ScanerEvent = Listener_ScanerEvent; } /// <summary>浏览器状态记录</summary> /// <param name="sender"></param> /// <param name="args"></param> private void OnBrowserStatusMessage(object sender, StatusMessageEventArgs args) { //loggerAlp.Info(args.Value); } /// <summary>浏览器错误信息记录</summary> /// <param name="o"></param> /// <param name="args"></param> private void OnConsoleMessage(object o, ConsoleMessageEventArgs args) { //loggerAlp.Info(string.Format("Line: {0}, Source: {1}, Message: {2}", args.Line, args.Source, args.Message)); } [Obsolete] private void Form1_Load(object sender, EventArgs e) { InitBrowser(); } //private void ShowInfo(BardCodeHooK.BarCodes barCode) //{ // if (this.InvokeRequired) // { // this.BeginInvoke(new ShowInfoDelegate(ShowInfo), new object[] { barCode }); // } // else // { // if (barCode.KeyName.Equals("Enter")) // { // //hook_KeyDown(value); // value = ""; // } // else // { // value = barCode.Chr.ToString();6972294972179 // } // } // MessageBox.Show(value); //} //void BarCode_BarCodeEvent(BardCodeHooK.BarCodes barCode) //{ // ShowInfo(barCode); //} private void Listener_ScanerEvent(ScanerHook.ScanerCodes codes) { MessageBox.Show(codes.Result); } private void Form1_FormClosed(object sender, FormClosedEventArgs e) { listener.Stop(); } //使用例1(LPT打印): // printLPT.PrintESC(0);  //打印前退纸 // printLPT.PrintDataSet(dsPrint); // printLPT.PrintESC(1);  //打印后进纸 }}

下载声明:

本站资源均有第三方用户自行上传分享推荐,非本站自制,仅供玩家做交流学习之用!切勿用于商业用途!游戏作品版权归原作者享有,如有版权问题,请附带版权证明至邮件,本平台将应您的要求删除。
相关推荐:

评论

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


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

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