private void AddFileToTopOfHistory(string filePath)
        {
            if (string.IsNullOrEmpty(filePath))
            {
                return;
            }

            // Delete item if it already exists
            filePath = Path.GetFullPath(filePath);

            foreach (var item in toolStripFileHistory.Items)
            {
                string itemPath = ((TemplateHistoryItem)item).FilePath;

                if (string.Compare(itemPath, filePath, true) == 0)
                {
                    toolStripFileHistory.Items.Remove(item);
                    break;
                }
            }

            // (re)Add to top of list
            toolStripFileHistory.Items.Insert(0, new TemplateHistoryItem(filePath));

            {
                toolStripFileHistory.SelectedIndexChanged -= new EventHandler(OnSelChangeTemplateHistoryCombo);
                toolStripFileHistory.SelectedIndex         = 0;
                toolStripFileHistory.SelectedIndexChanged += new EventHandler(OnSelChangeTemplateHistoryCombo);
            }

            FormsUtil.RecalcDropWidth(toolStripFileHistory.ComboBox);
        }
Пример #2
0
        private void BuildFontCombo(FontMappings fonts)
        {
            comboInstalledFont.SelectedItem = null;

            foreach (var fileFont in fonts.FileToNames)
            {
                foreach (var fontName in fileFont.Value)
                {
                    comboInstalledFont.Items.Add(fontName);
                }
            }

            FormsUtil.RecalcDropWidth(comboInstalledFont);
        }
Пример #3
0
 protected override void OnResize(EventArgs e)
 {
     FormsUtil.RecalcDropWidth(this);
 }