0 Replies - 296 Views - Last Post: 07 February 2012 - 11:41 AM Rate Topic: -----

Topic Sponsor:

#1 q12  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 26
  • Joined: 12-April 09

Web browser and Context menu strip problems

Posted 07 February 2012 - 11:41 AM

In a webControl, when the mouse cursor is "Hand" (usually over links,images), I want a custom contextMenu to be on or off. I tried to make something but is not working [the ContextMenuStrip is always showing,when I right click]. Why is this happening?

here is the code:
public Form1()
        {
            InitializeComponent();
            //I already set this in properties - showing here for clarity
            webBrowser1.IsWebBrowserContextMenuEnabled = false; 
            webBrowser1.ContextMenuStrip = contextMenuStrip1;
        }
        private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            if (this.Cursor == Cursors.Hand) contextMenuStrip1.Visible = true;
            else contextMenuStrip1.Visible = false;
        }



I suppose I must create a new event for Cursor...but is not working either. I don't really know how to do it right. Im not expert in making events. I don't understand them fully.

public Form1()
        {
            InitializeComponent();
            CursorChanged += new EventHandler(Form1_CursorChanged);
        }
void Form1_CursorChanged(object sender, EventArgs e)
       {
            if (this.Cursor == Cursors.Hand) contextMenuStrip1.Visible = true;
            else contextMenuStrip1.Visible = false;
       }


Is This A Good Question/Topic? 0
  • +

Page 1 of 1