本文整理汇总了C#中JSObject.SetBrowser方法的典型用法代码示例。如果您正苦于以下问题:C# JSObject.SetBrowser方法的具体用法?C# JSObject.SetBrowser怎么用?C# JSObject.SetBrowser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JSObject
的用法示例。
在下文中一共展示了JSObject.SetBrowser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChromiumBrowser
/// <summary>
/// Creates a ChromiumWebBrowser object with the given initial URL.
/// If createImmediately is true, then the underlying CfxBrowser is
/// created immediately with the default CfxRequestContext.
/// </summary>
public ChromiumBrowser(string initialUrl, bool createImmediately)
{
if (BrowserProcess.initialized)
{
SetStyle(ControlStyles.ContainerControl
| ControlStyles.ResizeRedraw
| ControlStyles.FixedWidth
| ControlStyles.FixedHeight
| ControlStyles.StandardClick
| ControlStyles.StandardDoubleClick
| ControlStyles.UserMouse
| ControlStyles.SupportsTransparentBackColor
| ControlStyles.EnableNotifyMessage
| ControlStyles.DoubleBuffer
| ControlStyles.OptimizedDoubleBuffer
| ControlStyles.UseTextForAccessibility
| ControlStyles.Opaque
, false);
SetStyle(ControlStyles.UserPaint
| ControlStyles.AllPaintingInWmPaint
| ControlStyles.CacheText
| ControlStyles.Selectable
, true);
if (initialUrl == null)
this.initialUrl = "about:blank";
else
this.initialUrl = initialUrl;
client = new BrowserClient(this);
globalObject = new JSObject();
globalObject.SetBrowser("window", this);
if (createImmediately)
CreateBrowser();
}
else
{
BackColor = System.Drawing.Color.White;
Width = 200;
Height = 160;
var label = new Label();
label.AutoSize = true;
label.Text = "ChromiumWebBrowser";
label.Parent = this;
}
}
示例2: GlobalObjectForFrame
/// <summary>
/// Represents a named frame's global javascript object (window).
/// Any changes to the global object's properties will be available
/// after the next time a V8 context is created in the render process
/// of this browser for a frame with this name.
/// </summary>
public JSObject GlobalObjectForFrame(string frameName)
{
JSObject obj;
if (!frameGlobalObjects.TryGetValue(frameName, out obj))
{
obj = new JSObject();
obj.SetBrowser("window", this);
frameGlobalObjects.Add(frameName, obj);
}
return obj;
}