I faced with a problem while i was tring to assign a context menu in WebBrowser control.
Before using navigate method of the control,
I was able to see my own custom context menu by right clicking on it.
But I was not able to see my own context menu after using navigate method and Internet Explore was putting its own context menu.
I add context menu to my application by using this code below
public Form1()
{
InitializeComponent();
ContextMenuStrip myContextMenuStrip = new System.Windows.Forms.ContextMenuStrip();
myContextMenuStrip.Items.Add("m1", null, myContextMenuItem_Click);
myContextMenuStrip.Items.Add("m2", null, myContextMenuItem_Click);
myContextMenuStrip.Items.Add("m3", null, myContextMenuItem_Click);
myContextMenuStrip.Items.Add("m4", null, myContextMenuItem_Click);
myContextMenuStrip.Items.Add("m5", null, myContextMenuItem_Click);
webBrowser1.ContextMenuStrip = myContextMenuStrip;
}
I was sure that there is something missing which is using
webBrowser1.IsWebBrowserContextMenuEnabled = false;
public Form1()
{
InitializeComponent();
ContextMenuStrip myContextMenuStrip = new System.Windows.Forms.ContextMenuStrip();
myContextMenuStrip.Items.Add("m1", null, myContextMenuItem_Click);
myContextMenuStrip.Items.Add("m2", null, myContextMenuItem_Click);
myContextMenuStrip.Items.Add("m3", null, myContextMenuItem_Click);
myContextMenuStrip.Items.Add("m4", null, myContextMenuItem_Click);
myContextMenuStrip.Items.Add("m5", null, myContextMenuItem_Click);
webBrowser1.ContextMenuStrip = myContextMenuStrip;
webBrowser1.IsWebBrowserContextMenuEnabled = false;
}
It was okey and I was just able to see my own context menu :)
Wednesday, December 7, 2011
Missing user defined context menu in WebBrowser Control
winforms
Etiketler:
.net,
C#,
ContextMenu,
ContextMenu Problems,
ContextMenuStrip,
WebControl,
Windows Forms,
winforms
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment