ViewManagerSetContextMenu Method |
Namespace: VIZCore3D.NET.Manager
public void SetContextMenu( ViewContextMenuKind kind, ContextMenuStrip contextMenu )
// VIZCore3D.NET Control private VIZCore3D.NET.VIZCore3DControl vizcore3d; private void Example() { // 단일 파트 선택 시 메뉴에 항목 추가 ContextMenuStrip menu = vizcore3d.View.GetContextMenu(VIZCore3D.NET.Data.ViewContextMenuKind.NODE_SINGLE); // Separator 추가 ToolStripSeparator separator = new ToolStripSeparator(); menu.Items.Add(separator); // Custom 메뉴 추가 ToolStripMenuItem item1 = new ToolStripMenuItem("Context Custom Menu Item 1"); item1.Click += ContextMenuItem1_Click; menu.Items.Add(item1); // Custom 메뉴 추가 ToolStripMenuItem item2 = new ToolStripMenuItem("Context Custom Menu Item 2"); item2.Click += ContextMenuItem2_Click; menu.Items.Add(item2); } private void ContextMenuItem1_Click(object sender, EventArgs e) { MessageBox.Show( "Clicked : Context Custom Menu Item 1" , "VIZCore3D.NET" , MessageBoxButtons.OK , MessageBoxIcon.Information ); } private void ContextMenuItem2_Click(object sender, EventArgs e) { MessageBox.Show( "Clicked : Context Custom Menu Item 2" , "VIZCore3D.NET" , MessageBoxButtons.OK , MessageBoxIcon.Information ); } private void SetCustomContextMenu(object sender, EventArgs e) { // customMenu : 디자이너에서 생성하거나 코드로 생성한 Context Menu Strip // 단일 노드 선택 시 조회되는 Context Menu에 새로운 Context Menu 할당 vizcore3d.View.SetContextMenu( VIZCore3D.NET.Data.ViewContextMenuKind.NODE_SINGLE , customMenu ); }