Skip to content

Commit b78e166

Browse files
committed
Example below shows how to use a control to host DevTools (in this case it's added as a new TabPage)
1 parent 509ab98 commit b78e166

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

CefSharp.WinForms.Example/BrowserForm.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,38 @@ private void ShowDevToolsMenuItemClick(object sender, EventArgs e)
224224
if (control != null)
225225
{
226226
control.Browser.ShowDevTools();
227+
228+
//Example below shows how to use a control to host DevTools
229+
//(in this case it's added as a new TabPage)
230+
//var tabPage = new TabPage("DevTools")
231+
//{
232+
// Dock = DockStyle.Fill
233+
//};
234+
235+
//var panel = new Panel
236+
//{
237+
// Dock = DockStyle.Fill
238+
//};
239+
240+
////We need to call CreateControl as we need the Handle later
241+
//panel.CreateControl();
242+
243+
//tabPage.Controls.Add(panel);
244+
245+
//browserTabControl.TabPages.Add(tabPage);
246+
247+
////Make newly created tab active
248+
//browserTabControl.SelectedTab = tabPage;
249+
250+
////Grab the client rect
251+
//var rect = panel.ClientRectangle;
252+
//var webBrowser = control.Browser;
253+
//var browser = webBrowser.GetBrowser().GetHost();
254+
//var windowInfo = new WindowInfo();
255+
////DevTools becomes a child of the panel, we use it's dimesions
256+
//windowInfo.SetAsChild(panel.Handle, rect.Left, rect.Top, rect.Right, rect.Bottom);
257+
////Show DevTools in our panel
258+
//browser.ShowDevTools(windowInfo);
227259
}
228260
}
229261

0 commit comments

Comments
 (0)