I thought this would be a simple matter but its not, this control is not like other controls, it seems. What I try is that I have a menubar/toolbar at the top of the program that I have a dropdown button in and under this I have some items. I should have access to a particular part of this control namely the ability to put a check mark at a selected item in this list but this is not possible to get it via code. I only have it to manually set this in the designer. I want it via code to be able to put a check mark to. And I've tried this code to get it and I get hold of most of the control but it does not have the ability to set or clear the check mark that appears to.
Code:
foreach (ToolStripDropDownItem fontItem in this.cmFontSizes.DropDownItems)
{
fontItem.Checked = true;
}
It was proved easy to do that and I just used the correct reference. The code is
Code:
foreach (ToolStripMenuItem fontItem in this.cmFontSizes.DropDownItems)
{
if (fontItem.Text == "48")
{
fontItem.Checked = true;
}
else
{
fontItem.Checked = false;
}
}
But I am thinking if there is any better way to do this. Do you have any suggestions to this?
Bookmarks