Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/28/13 10:41:57 (12 years ago)
Author:
ascheibe
Message:

#2030 merged trunk into branch

Location:
branches/HivePerformance/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HivePerformance/sources

  • branches/HivePerformance/sources/HeuristicLab.Data.Views/3.3/StringConvertibleArrayView.cs

    r9539 r9663  
    2323using System.ComponentModel;
    2424using System.Drawing;
     25using System.Linq;
    2526using System.Text;
    2627using System.Windows.Forms;
     
    5354
    5455    protected override void DeregisterContentEvents() {
     56      Content.ElementNamesChanged -= new EventHandler(Content_ElementNamesChanged);
    5557      Content.ItemChanged -= new EventHandler<EventArgs<int>>(Content_ItemChanged);
    5658      Content.Reset -= new EventHandler(Content_Reset);
     
    6264      Content.ItemChanged += new EventHandler<EventArgs<int>>(Content_ItemChanged);
    6365      Content.Reset += new EventHandler(Content_Reset);
     66      Content.ElementNamesChanged += new EventHandler(Content_ElementNamesChanged);
    6467    }
    6568
     
    9699        dataGridView.Columns[0].Width = dataGridView.Columns[0].GetPreferredWidth(DataGridViewAutoSizeColumnMode.AllCells, true);
    97100      }
     101      UpdateRowHeaders();
     102      dataGridView.AutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode.AutoSizeToDisplayedHeaders);
    98103      dataGridView.Enabled = true;
     104    }
     105
     106    protected virtual void UpdateRowHeaders() {
     107      for (int i = 0; i < dataGridView.RowCount; i++) {
     108        if (i < Content.ElementNames.Count())
     109          dataGridView.Rows[i].HeaderCell.Value = Content.ElementNames.ElementAt(i);
     110        else
     111          dataGridView.Rows[i].HeaderCell.Value = string.Empty;
     112      }
     113    }
     114
     115    private void Content_ElementNamesChanged(object sender, EventArgs e) {
     116      if (InvokeRequired)
     117        Invoke(new EventHandler(Content_ElementNamesChanged), sender, e);
     118      else
     119        UpdateRowHeaders();
    99120    }
    100121
Note: See TracChangeset for help on using the changeset viewer.