[Mono-list] popup a menu
Paul
paul@all-the-johnsons.co.uk
Wed, 05 Jan 2005 02:11:01 +0000
--=-8cpICVmdhlC1X3/U+Oc2
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
Hi
> Anybody can give me a example about popup a menu by using
> contextmenu.=20
This really should be on the mono-devel list...
protected void contextMenu1_Popup(System.Object sender, System.EventArgs
e)
{
// Clear the contents of the context menu.
contextMenu1.MenuItems.Clear();
// Add a menu item for the Checked state.
contextMenu1.MenuItems.Add("Checked",new System.EventHandler(this.Checke=
d_OnClick));
// Add a menu item for the Unchecked state.
contextMenu1.MenuItems.Add("Unchecked",new System.EventHandler(this.Unch=
ecked_OnClick));
// Test which control it is.
// If it is the CheckBox, add a menu item for the Indeterminate state.
if (contextMenu1.SourceControl =3D=3D checkBox1)
{
this.contextMenu1.MenuItems.Add("Indeterminate", new System.EventHandl=
er(this.Indeterminate_OnClick));
}
}
TTFN
Paul
--=20
"He's not the Messiah, he's a very naughty boy!"
- Life of Brian, Monty Python
--=-8cpICVmdhlC1X3/U+Oc2
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
iD8DBQBB20y1usSVe5EZv3wRArbvAJ91MCGhBNJLcMBnwhJ5CguEdFUsTwCdFawV
NZes7udVlKNL4rl2FI2ET70=
=WhP2
-----END PGP SIGNATURE-----
--=-8cpICVmdhlC1X3/U+Oc2--