// Static method to browse for texture or flat // Returns null when cancelled. public static string Browse(IWin32Window parent, string select, bool browseFlats) { TextureBrowserForm browser = new TextureBrowserForm(select, browseFlats); if (browser.ShowDialog(parent) == DialogResult.OK) { return(browser.SelectedName); // Return result } // Cancelled return(select); }
// Static method to browse for texture // Returns null when cancelled. public static string Browse(IWin32Window parent, string select, bool browseflats) { TextureBrowserForm browser = new TextureBrowserForm(select, browseflats); if(browser.ShowDialog(parent) == DialogResult.OK) { // Return result return browser.SelectedName; } else { // Cancelled return select; } }
// Browse flat private void selectflat_Click(object sender, EventArgs e) { // Browse for flat string result = TextureBrowserForm.Browse(this, backgroundname, true); if (result != null) { // Set this flat as background backgroundname = result; backgroundsource = GridSetup.SOURCE_FLATS; ImageData img = General.Map.Data.GetFlatImage(result); General.DisplayZoomedImage(backgroundimage, img.GetBackgroundBitmap()); } }
// Browse texture private void selecttexture_Click(object sender, EventArgs e) { // Browse for texture string result = TextureBrowserForm.Browse(this, backgroundname, false); if (result != null) { // Set this texture as background backgroundname = result; backgroundsource = GridSetup.SOURCE_TEXTURES; ImageData img = General.Map.Data.GetTextureImage(result); General.DisplayZoomedImage(backgroundimage, img.GetBackgroundBitmap()); } }
// Static method to browse for texture or flat. public static string Browse(IWin32Window parent, string select, bool browseflats) { TextureBrowserForm browser = new TextureBrowserForm(select, browseflats); return(browser.ShowDialog(parent) == DialogResult.OK ? browser.SelectedName : select); }