Beispiel #1
0
 private void OnBnRemove(object sender, EventArgs e)
 {
     try
     {
         HalfAxis.HAxis currentAxis    = SelectedFace;
         Texture        currentTexture = SelectedTexture;
         _textures.RemoveAll(delegate(Pair <HalfAxis.HAxis, Texture> p) { return(p.first == currentAxis && p.second == currentTexture); });
         // update bitmap control
         FillBitmapControl(SelectedFace);
         // select first texture available in list
         if (listBoxTextures.Items.Count > 0)
         {
             ListBoxImagesItem item = listBoxTextures.Items[0] as ListBoxImagesItem;
             SelectedTexture = item.Texture;
         }
         else
         {
             OnSelectedTextureChanged(this, null);
         }
         // draw box
         graphCtrl.Invalidate();
     }
     catch (Exception ex)
     {
         _log.Error(ex.ToString());
     }
 }
Beispiel #2
0
 /// <summary>
 /// overrides ListBox.OnDrawItem
 /// </summary>
 /// <param name="e">event argument used to retrieve item by index</param>
 protected override void OnDrawItem(DrawItemEventArgs e)
 {
     // prevent Visual Designer errors
     if (this.Items.Count > 0)
     {
         ListBoxImagesItem item = (ListBoxImagesItem)this.Items[e.Index];
         item.drawItem(e, this.Margin, this._imageSize, e.Index == SelectedIndex);
     }
 }