/// <summary> /// Creates and shows an Item context menu at the mouse pointer /// </summary> public ContextMenuStrip ItemContextMenu() { var top = new ToolStripMenuItem("Move to &Top"); top.Click += (o, args) => { SetItem(SelectedScene.MoveItem(SelectedItem, obs_order_movement.OBS_ORDER_MOVE_TOP)); }; var up = new ToolStripMenuItem("Move &Up"); up.Click += (o, args) => { SetItem(SelectedScene.MoveItem(SelectedItem, obs_order_movement.OBS_ORDER_MOVE_UP)); }; var down = new ToolStripMenuItem("Move &Down"); down.Click += (o, args) => { SetItem(SelectedScene.MoveItem(SelectedItem, obs_order_movement.OBS_ORDER_MOVE_DOWN)); }; var bottom = new ToolStripMenuItem("Move to &Bottom"); bottom.Click += (o, args) => { SetItem(SelectedScene.MoveItem(SelectedItem, obs_order_movement.OBS_ORDER_MOVE_BOTTOM)); }; var transform = new ToolStripMenuItem("&Edit Transform Options..."); transform.Click += (o, args) => { var transformfrm = new TestTransform(SelectedItem); transformfrm.ShowDialog(); }; var prop = new ToolStripMenuItem("&Edit Source Properties..."); prop.Click += (sender, args) => { var propfrm = new TestProperties(SelectedItem.GetSource()); propfrm.ShowDialog(); }; var visible = new ToolStripBindableMenuItem { Text = "&Visible", CheckOnClick = true }; visible.DataBindings.Add(new Binding("Checked", SelectedItem, "Visible", false, DataSourceUpdateMode.OnPropertyChanged)); var ordermenu = new ContextMenuStrip { Renderer = new AccessKeyMenuStripRenderer() }; ordermenu.Items.AddRange(new ToolStripItem[] { top, up, down, bottom, new ToolStripSeparator(), visible, new ToolStripSeparator(), transform, prop }); int index = SelectedScene.Items.IndexOf(SelectedItem); top.Enabled = up.Enabled = index != 0; down.Enabled = bottom.Enabled = index != SelectedScene.Items.Count - 1; return ordermenu; }
/// <summary> /// Creates and shows an Item context menu at the mouse pointer /// </summary> public ContextMenuStrip ItemContextMenu() { var top = new ToolStripMenuItem("Move to &Top"); top.Click += (o, args) => { SetItem(SelectedScene.MoveItem(SelectedItem, obs_order_movement.OBS_ORDER_MOVE_TOP)); }; var up = new ToolStripMenuItem("Move &Up"); up.Click += (o, args) => { SetItem(SelectedScene.MoveItem(SelectedItem, obs_order_movement.OBS_ORDER_MOVE_UP)); }; var down = new ToolStripMenuItem("Move &Down"); down.Click += (o, args) => { SetItem(SelectedScene.MoveItem(SelectedItem, obs_order_movement.OBS_ORDER_MOVE_DOWN)); }; var bottom = new ToolStripMenuItem("Move to &Bottom"); bottom.Click += (o, args) => { SetItem(SelectedScene.MoveItem(SelectedItem, obs_order_movement.OBS_ORDER_MOVE_BOTTOM)); }; var transform = new ToolStripMenuItem("&Edit Transform Options..."); transform.Click += (o, args) => { var transformfrm = new TestTransform(SelectedItem); transformfrm.ShowDialog(); }; var prop = new ToolStripMenuItem("&Edit Source Properties..."); prop.Click += (sender, args) => { var propfrm = new TestProperties(SelectedItem.GetSource()); propfrm.ShowDialog(); }; var visible = new ToolStripBindableMenuItem { Text = "&Visible", CheckOnClick = true }; visible.DataBindings.Add(new Binding("Checked", SelectedItem, "Visible", false, DataSourceUpdateMode.OnPropertyChanged)); var ordermenu = new ContextMenuStrip { Renderer = new AccessKeyMenuStripRenderer() }; ordermenu.Items.AddRange(new ToolStripItem[] { top, up, down, bottom, new ToolStripSeparator(), visible, new ToolStripSeparator(), transform, prop }); int index = SelectedScene.Items.IndexOf(SelectedItem); top.Enabled = up.Enabled = index != 0; down.Enabled = bottom.Enabled = index != SelectedScene.Items.Count - 1; return(ordermenu); }