0
是否可以將像CheckBox這樣的控件添加到ContextMenuStrip?我可以將控件添加到ContextMenuStrip嗎?
我希望能夠在選擇菜單選項之前勾選幾個選項。
這是我現在做的,但我已經註釋掉了,我嘗試添加chkBox - 因爲它不工作:
DataGridView gridView = sender as DataGridView;
ContextMenuStrip my_menu = new ContextMenuStrip();
int colIndex = gridView.HitTest(e.X, e.Y).ColumnIndex;
Globals.PlotColumnIndex = colIndex;
my_menu.Items.Add("New plot").Name = "New plot";
my_menu.Items.Add("New trades plot").Name = "New trades plot";
my_menu.Items.Add("Add to existing plot").Name = "Add to existing plot";
my_menu.Items.Add("Add to existing plot Y2").Name = "Add to existing plot Y2";
CheckBox chkBox = new CheckBox();
chkBox.Text = "Option 1";
//my_menu.Controls.Add(chkBox);
my_menu.Show(gridView, new Point(e.X, e.Y));
my_menu.ItemClicked += new ToolStripItemClickedEventHandler(my_menu_ItemClicked);
肯定是一個標準的可檢查菜單項會做什麼? – Lloyd