private void selectedPlaceProps_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) { FileDialogPlaceBase place = (FileDialogPlaceBase)placesListBox.SelectedItem; ((CurrencyManager)placesListBox.BindingContext[m_places]).Refresh(); bool multipleLines; ToolStripButton placeButton = (ToolStripButton)placesBar.Items[placesListBox.SelectedIndex]; placeButton.Text = FileDialog.InsertLineBreaks(place.Text, out multipleLines); placeButton.Padding = new Padding(0, multipleLines ? 3 : 8, 0, multipleLines ? 0 : 8); if (e.ChangedItem.Label == "Path") { placeButton.Image = ShellImageList.GetImage(place.PIDL); } }
private void AddPlace(FileDialogPlaceBase place) { m_places.Add(place); ((CurrencyManager)placesListBox.BindingContext[m_places]).Refresh(); bool multipleLines; ToolStripButton placeButton = new ToolStripButton(FileDialog.InsertLineBreaks(place.Text, out multipleLines)); placeButton.Image = ShellImageList.GetImage(place.PIDL); placeButton.ImageAlign = ContentAlignment.BottomCenter; placeButton.Margin = new Padding(1, 0, 0, 0); placeButton.Padding = new Padding(0, multipleLines ? 3 : 8, 0, multipleLines ? 0 : 8); placeButton.Tag = place; placeButton.TextImageRelation = TextImageRelation.ImageAboveText; placesBar.Items.Add(placeButton); placesListBox.ClearSelected(); placesListBox.SelectedIndex = placesListBox.Items.Count - 1; }