mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-06 20:19:41 +00:00
47916e5639
The additions to MovingListener (and the fields it sets on ChromiumWebBrowser) are ONLY there for debugging related purposes. They will disappear when folks are happy with the results.
71 lines
2.5 KiB
C#
71 lines
2.5 KiB
C#
// Copyright © 2010-2014 The CefSharp Authors. All rights reserved.
|
|
//
|
|
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
|
|
|
|
using CefSharp.Internals;
|
|
using System;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
|
|
namespace CefSharp.WinForms.Example.Minimal
|
|
{
|
|
public partial class TabulationDemoForm : Form
|
|
{
|
|
private readonly ChromiumWebBrowser chromiumWebBrowser;
|
|
|
|
public TabulationDemoForm()
|
|
{
|
|
InitializeComponent();
|
|
chromiumWebBrowser = new ChromiumWebBrowser(txtURL.Text) { Dock = DockStyle.Fill };
|
|
var userControl = new UserControl { Dock = DockStyle.Fill };
|
|
userControl.Enter += userControl_Enter;
|
|
userControl.Leave += userControl_Leave;
|
|
userControl.Controls.Add(chromiumWebBrowser);
|
|
grpBrowser.Controls.Add(userControl);
|
|
}
|
|
|
|
void userControl_Leave(object sender, EventArgs e)
|
|
{
|
|
txtDummy.Text = "UserControl OnLeave";
|
|
}
|
|
|
|
void userControl_Enter(object sender, EventArgs e)
|
|
{
|
|
txtDummy.Text = "UserControl OnEnter";
|
|
}
|
|
|
|
private void BtnGoClick(object sender, EventArgs e)
|
|
{
|
|
chromiumWebBrowser.Load(txtURL.Text);
|
|
}
|
|
|
|
private void TxtUrlLeave(object sender, EventArgs e)
|
|
{
|
|
txtURL.BackColor = Color.White;
|
|
}
|
|
|
|
private void TxtUrlEnter(object sender, EventArgs e)
|
|
{
|
|
txtURL.BackColor = Color.Yellow;
|
|
}
|
|
|
|
protected override void OnActivated(EventArgs e)
|
|
{
|
|
Kernel32.OutputDebugString(String.Format("Form OnActivated: ACType: {2}, ActiveControl.Handle: {0} BrowserControlHandle: {1}\r\n",
|
|
ActiveControl != null ? ((int)ActiveControl.Handle).ToString() : "null",
|
|
chromiumWebBrowser.Handle,
|
|
ActiveControl != null ? ActiveControl.GetType().FullName : "null"));
|
|
base.OnActivated(e);
|
|
}
|
|
|
|
protected override void OnDeactivate(EventArgs e)
|
|
{
|
|
Kernel32.OutputDebugString(String.Format("Form OnDeActivated: ACType: {2}, ActiveControl.Handle: {0} BrowserControlHandle: {1}\r\n",
|
|
ActiveControl != null ? ((int)ActiveControl.Handle).ToString() : "null",
|
|
chromiumWebBrowser.Handle,
|
|
ActiveControl != null ? ActiveControl.GetType().FullName : "null"));
|
|
base.OnDeactivate(e);
|
|
}
|
|
}
|
|
}
|