I am programmatically adding dropdown items to my menustripitem, but the width is about an inch wide when I need it to be wider. How can I set the width?
internal ToolStripButton buttonRecents;
List<string> recentFilesList = new List<string>();
private void frmMain_Load(object sender, EventArgs e)
{
populateRecentFilesList(); // populate generic list
populateRecentFilesMenuItemDropdown();
}
private void populateRecentFilesList()
{
// Populate Recent Databases List
// If the xml file does not exist, create it.
if (!File.Exists("recentFiles.xml"))
createRecentFilesXml();
XmlDocument myXmlDocument = new XmlDocument();
myXmlDocument.Load("recentFiles.xml");
XmlNode rootNode;
rootNode = myXmlDocument.DocumentElement;
recentFilesList.Clear();
foreach (XmlNode xNode in rootNode.ChildNodes)
{
if (xNode.InnerText != "")
{
// Populate generic list
recentFilesList.Add(xNode.InnerText);
}
}
}
private void populateRecentFilesMenuItemDropdown()
{
ToolStripItem[] tsItem = new ToolStripItem[recentFilesList.Count];
for (int i = 0; i < recentFilesList.Count; i++)
{
buttonRecents = new ToolStripButton();
buttonRecents.Text = recentFilesList[i];
buttonRecents.Click += new EventHandler(recentButtonsClick);
tsItem[i] = buttonRecents;
}
this.recentDatabasesToolStripMenuItem.DropDownItems.Clear();
this.recentDatabasesToolStripMenuItem.DropDownItems.AddRange(tsItem);
}Experience trumps brilliance -- Thomas Sowell