private void InitItems() { _idToWorkPreference = new TypedHashtable <string, WorkPreference>(); IPreferences preferences = OptionDialogPlugin.Instance.RootPreferences; int y = 8; for (int i = 0; i < _entries.Length; i++) { IOptionPanelExtension e = _entries[i].Extension; foreach (string pref_id in e.PreferenceFolderIDsToEdit) { WorkPreference wp = _idToWorkPreference[pref_id]; if (wp == null) //add entry { IPreferenceFolder folder = preferences.FindPreferenceFolder(pref_id); if (folder == null) { throw new Exception(pref_id + " not found"); } _idToWorkPreference.Add(pref_id, new WorkPreference(folder)); } } PanelItem item = new PanelItem(this, i, e.Icon, e.Caption); item.Location = new Point(4, y); _categoryItems.Controls.Add(item); y += 52; } this.ClientSize = new Size(this.ClientSize.Width, y + 42); //項目が増えたら高さが増える }
private void InitItems() { _idToWorkPreference = new TypedHashtable <string, WorkPreference>(); IPreferences preferences = OptionDialogPlugin.Instance.RootPreferences; int y = 8; for (int i = 0; i < _entries.Length; i++) { IOptionPanelExtension e = _entries[i].Extension; foreach (string pref_id in e.PreferenceFolderIDsToEdit) { WorkPreference wp = _idToWorkPreference[pref_id]; if (wp == null) //add entry { IPreferenceFolder folder = preferences.FindPreferenceFolder(pref_id); if (folder == null) { throw new Exception(pref_id + " not found"); } _idToWorkPreference.Add(pref_id, new WorkPreference(folder)); } } PanelItem item = new PanelItem(this, i, e.Icon, e.Caption); item.Location = new Point(3, y); _categoryItems.Controls.Add(item); y += 52; } // 項目が増えた場合はパネルにスクロールを表示させてパネル幅/フォーム幅を変更する // ※項目数が増えれば増えるほどフォーム自体が縦長になってしまい表示しきれない懸念がある // ※今後プラグインでどれだけ項目数を増やしてもスクロールを表示することで対応 if (y > _categoryItems.ClientSize.Height) { _categoryItems.AutoScroll = true; _categoryItems.Width += SystemInformation.VerticalScrollBarWidth; this.Width += SystemInformation.VerticalScrollBarWidth; } }