public void AddBitmap(string name, Bitmap bitmap) { if (bitmap != null) { bool found = false; for (var i = 0; i < Bitmaps.Count; i++) { var item = Bitmaps[i]; if (name.Equals(item.Name)) { found = true; break; } } if (!found) { Bitmaps.Add(new BitmapItem(name, bitmap)); BitmapList.Items.Add(name); BitmapList.SelectedIndex = BitmapList.Items.Count - 1; SpatialLightModulator.SetBitmap(ref bitmap); } } }
private void SetBitmapButton_Click(object sender, System.EventArgs e) { if (BitmapList.SelectedIndex >= 0 && Bitmaps.Count > 0 && BitmapList.SelectedIndex <= Bitmaps.Count) { SpatialLightModulator.SetBitmap(ref Bitmaps[BitmapList.SelectedIndex].Bitmap); SpatialLightModulator.Show(); } }