Add border item to WebBrowser control

When I add a WebBrowser control to a TabPage tab, it has no border. I can not find the BorderStyle attribute. How to get control in order to have a border? (3D, sunken, whatever)

Screen shot

Only next to the scroll bar do you see a control there ...

+6
source share
3 answers

Gumpy comments, inaccurate. Add a new class to your project and paste the code shown below. Compilation. Drop the new control on top of the toolbar onto your shape.

using System;
using System.Windows.Forms;

class MyWebBrowser : WebBrowser {
  protected override CreateParams CreateParams {
    get {
      var parms = base.CreateParams;
      parms.Style |= 0x800000;  // Turn on WS_BORDER
      return parms;
    }
  }
}

Other border styles also work, check out WinUser.h in the SDK.

+14
source

WebBrowser Panel Panel.BorderStyle.

Panel panel1 = new Panel();
panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
panel1.Controls.Add(webbrowser1);
+8

, IE 6 ,

<! DOCTYPE html >

body {border-style: inset; : 2px; : 0px; }

IE.

, # DOCTYPE,

html, body {border: 0; }

IE 6.


Hans ( WS_BORDER) .

, :

protected override CreateParams CreateParams
{
    get
    {
        CreateParams i_Parms = base.CreateParams;
        i_Parms.ExStyle |= 0x200;  // WS_EX_CLIENTEDGE
        return i_Parms;
    }
}

, 3D- Windows 2000. XP, UXTHEME.DLL , USER32.DLL. User.h Windows 2000 XP Theme.

, , XP/Windows 7 ListBox, ListView, TreeView .. ( ) ?

ListBox VS , , , :

protected override void OnLoad(EventArgs e)
{
    ....
    listBox.IntegralHeight = false;
    webBrowser.Parent = listBox;
    webBrowser.Dock   = DockStyle.Fill;
}

. , - Html.

, , , , , .

, DrawThemeBackground DrawThemeEdge, GetThemeColor System.Drawing.Graphics.DrawRectangle() , . ( , )

+1

All Articles