public Bitmap GetThumbnail(Bootstrap.BrushPalette palette) { // if there are no brushes, use the error thumbnail. if (palette.GetBrushCount() == 0) { return(GetErrorThumbnail()); } // otherwise return the thumbnail of the first brush. return(GetThumbnail(palette.GetBrush(0))); }
void thumbnailSelector_SelectionChanged(object sender, EventArgs e) { Controls.Thumbnail selected = thumbnailSelector.Selected; if (selected != null) { _selection = new Bootstrap.BrushPalette(selected.UserData); } else { _selection = null; } }
void PopulateThumbnails() { // remove existing brush palettes. thumbnailSelector.Clear(); // get all brush palettes from the loaded scripts. string[] paletteNames = Bootstrap.BrushPalette.GetBrushPaletteNameList(); // iterate through each brush palette and add a thumbnail. foreach (string name in paletteNames) { // create a manipulator for the current brush palette. using (Bootstrap.BrushPalette palette = new Bootstrap.BrushPalette(name)) { // add the thumbnail to the selection dialog. thumbnailSelector.Add(palette.Name, Program.ThumbnailMgr.GetThumbnail(palette), palette.Name); } } }
public Bootstrap.BrushPalette NewPalette() { // reload all palettes. ReloadScripts(); // ask the user for the name of a palette. string name = ""; using (TextEntryDialog grabName = new TextEntryDialog()) { grabName.Title = "Create Palette"; grabName.Caption = "Name"; DialogResult result = grabName.ShowDialog(); if (result != DialogResult.OK || grabName.TextResult == "") { return(null); } name = grabName.TextResult; } // create the palette. Bootstrap.BrushPalette palette = Bootstrap.BrushPalette.Create(name); // save the palette. Bootstrap.BrushPalette.SaveBrushPalettes(); // repopulate the thumbnails. PopulateThumbnails(); // select the palette. thumbnailSelector.SelectedName = palette.Name; // return the palette. return(palette); }