Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
* A simple contextmenu test with a treeview
Browse files Browse the repository at this point in the history
2008-02-21  Andreia Gaita <avidigal@novell.com>

svn path=/trunk/winforms/; revision=96323
  • Loading branch information
shana committed Feb 21, 2008
1 parent b395a74 commit bd8e857
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 3 deletions.
9 changes: 6 additions & 3 deletions contextmenu/Makefile
@@ -1,15 +1,18 @@
all: mono

mono: swf-basicmenu.cs swf-popups.cs
mono: swf-basicmenu.cs swf-popups.cs contextmenu.cs
mcs swf-basicmenu.cs /r:System.Windows.Forms.dll /r:System.Drawing.dll
mcs swf-popups.cs /r:System.Windows.Forms.dll /r:System.Drawing.dll
gmcs contextmenu.cs /r:System.Windows.Forms.dll /r:System.Drawing.dll

dotnet: swf-basicmenu.cs swf-popups.cs
dotnet: swf-basicmenu.cs swf-popups.cs contextmenu.cs
csc swf-basicmenu.cs /r:System.Windows.Forms.dll /r:System.Drawing.dll
mcs swf-popups.cs /r:System.Windows.Forms.dll /r:System.Drawing.dll
csc swf-popups.cs /r:System.Windows.Forms.dll /r:System.Drawing.dll
csc contextmenu.cs /r:System.Windows.Forms.dll /r:System.Drawing.dll

clean:
rm swf-contextmenu.exe -r -f
rm swf-popups.cs -r -f
rm contextmenu.cs -r -f


35 changes: 35 additions & 0 deletions contextmenu/contextmenu.cs
@@ -0,0 +1,35 @@
using System;
using System.Drawing;
using System.Windows.Forms;

namespace winforms {

public class form : Form {

public static void Main () {
Application.Run (new form ());
}

public form () {

TreeView tree = new TreeView ();
ContextMenu popupmenu = new ContextMenu ( new MenuItem [] {
new MenuItem ("Menu 1"),
new MenuItem ("Menu 2"),
new MenuItem ("Menu 3")
});

TreeNode t;
t = tree.Nodes.Add ("Node 1");
t.ContextMenu = popupmenu;
t = tree.Nodes.Add ("Node 2");
t.ContextMenu = popupmenu;
t = tree.Nodes.Add ("Node 3");
t.ContextMenu = popupmenu;

tree.Dock = DockStyle.Fill;
this.Controls.Add (tree);

}
}
}

0 comments on commit bd8e857

Please sign in to comment.