public MapBackground GetMapBackground() { if (maps.Contains((String)MapsList.SelectedItem)) { return((MapBackground)maps[(String)MapsList.SelectedItem]); } else { IMGEntry entry = MapEditor.file.Directory.GetIMG("Map/" + (String)MapsList.SelectedItem); if (entry == null) { maps.Add((String)MapsList.SelectedItem, null); return(null); } else { MapBackground bg = new MapBackground(); MapBackground.Object = entry; lock (MapEditor.MapLock) bg.Load(); maps.Add((String)MapsList.SelectedItem, bg); return(bg); } } }
public MapBackground GetMapBackground() { if (maps.Contains((String)MapsList.SelectedItem)) { return (MapBackground)maps[(String)MapsList.SelectedItem]; } else { IMGEntry entry = MapEditor.file.Directory.GetIMG("Map/" + (String)MapsList.SelectedItem); if (entry == null) { maps.Add((String)MapsList.SelectedItem, null); return null; } else { MapBackground bg = new MapBackground(); MapBackground.Object = entry; lock(MapEditor.MapLock) bg.Load(); maps.Add((String)MapsList.SelectedItem, bg); return bg; } } }
private void SelectBackground_Click(object sender, EventArgs e) { MapBackgroundSelect select = new MapBackgroundSelect(selectedBGName); select.ShowDialog(); selectedBG = select.GetMapBackground(); BackgroundPreview.Image = selectedBG.GetThumb(); selectedBGName = (string)select.MapsList.SelectedItem; }
private void MapsList_SelectedIndexChanged(object sender, EventArgs e) { MapBackground bg = GetMapBackground(); if (bg != null) { if (!select.Enabled) { select.Enabled = true; } BackgroundPreview.Image = bg.Bitmap; } else { select.Enabled = false; BackgroundPreview.Image = null; } }