下列代码展示了如何创建一个弹出式菜单,并添加了两个菜单项:
C# | 复制代码 |
---|---|
PopupMenu menu = new PopupMenu(); // Bind the menu to a bar manager. menu.Manager = barManager1; // Add two items that belong to the bar manager. menu.ItemLinks.Add(barManager1.Items["iCopy"]); menu.ItemLinks.Add(barManager1.Items["iPaste"]); |
Visual Basic | 复制代码 |
---|---|
Dim menu As PopupMenu = New PopupMenu() ' Bind the menu to a bar manager. menu.Manager = barManager1 ' Add two items that belong to the bar manager. menu.ItemLinks.Add(barManager1.Items("iCopy")) menu.ItemLinks.Add(barManager1.Items("iPaste")) |