Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6707


Ignore:
Timestamp:
09/05/11 14:02:51 (13 years ago)
Author:
gkronber
Message:

#1633: added a tooltip that displays the index of columns

Location:
branches/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/View
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/View/ColumnGroupView.Designer.cs

    r6134 r6707  
    6565    /// </summary>
    6666    private void InitializeComponent() {
     67      this.components = new System.ComponentModel.Container();
    6768      System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
    6869      System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
     
    8586      this.lblStdDev = new System.Windows.Forms.Label();
    8687      this.lblMedian = new System.Windows.Forms.Label();
     88      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    8789      ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
     90      ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
    8891      this.splitContainer1.Panel1.SuspendLayout();
    8992      this.splitContainer1.Panel2.SuspendLayout();
     
    132135      this.txtColumnGroupName.Size = new System.Drawing.Size(397, 20);
    133136      this.txtColumnGroupName.TabIndex = 1;
     137      this.txtColumnGroupName.Click += new System.EventHandler(this.txtColumnGroupName_Click);
    134138      this.txtColumnGroupName.DoubleClick += new System.EventHandler(this.txtColumnGroupName_DoubleClick);
    135       this.txtColumnGroupName.Click += new System.EventHandler(this.txtColumnGroupName_Click);
    136139      this.txtColumnGroupName.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtColumnGroupName_KeyDown);
    137140      this.txtColumnGroupName.Leave += new System.EventHandler(this.txtColumnGroupName_Leave);
     
    321324      this.splitContainer1.Panel1.PerformLayout();
    322325      this.splitContainer1.Panel2.ResumeLayout(false);
     326      ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
    323327      this.splitContainer1.ResumeLayout(false);
    324328      this.tableLayoutPanel1.ResumeLayout(false);
     
    348352    private System.Windows.Forms.Label label7;
    349353    private System.Windows.Forms.Label lblStdDev;
     354    private System.Windows.Forms.ToolTip toolTip;
    350355  }
    351356}
  • branches/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/View/ColumnGroupView.cs

    r6134 r6707  
    4949      this.dataGridView.Dock = DockStyle.Top | DockStyle.Bottom;
    5050      this.dataGridView.VirtualMode = true;
     51      this.dataGridView.ShowCellToolTips = false;
    5152
    5253      this.dataGridView.ColumnHeaderMouseClick += new DataGridViewCellMouseEventHandler(dataGridView_ColumnHeaderMouseClick);
     
    6061      this.dataGridView.Resize += new EventHandler(dataGridView_Resize);
    6162      this.dataGridView.RowHeadersWidthChanged += new EventHandler(dataGridView_RowHeadersWidthChanged);
     63      this.dataGridView.CellMouseEnter += new DataGridViewCellEventHandler(dataGridView_CellMouseEnter);
    6264
    6365      //delegates for virtual mode
     
    480482    }
    481483
     484    private void dataGridView_CellMouseEnter(object sender, DataGridViewCellEventArgs e) {
     485      if (e.RowIndex == -1 && e.ColumnIndex != -1) {
     486        toolTip.SetToolTip(this.dataGridView, ToExcelColumnIndex(e.ColumnIndex));
     487      } else {
     488        toolTip.Hide(this.dataGridView);
     489      }
     490    }
     491
     492
     493
     494    private string ToExcelColumnIndex(int index) {
     495      //if (symb.Length == 1) {       // 'A' .. 'Z'
     496      //  return TryTranslateColumnIndexDigit(symb[0], out columnIndex);
     497      //} else if (symb.Length == 2) { // 'AA' ... 'ZZ'
     498      //  bool ok;
     499      //  int d0, d1;
     500      //  ok = TryTranslateColumnIndexDigit(symb[0], out d1) & TryTranslateColumnIndexDigit(symb[1], out d0);
     501      //  columnIndex = (d1 + 1) * 26 + d0;
     502      //  return ok;
     503      //} else {
     504      //  columnIndex = 0;
     505      //  return false;
     506      //}
     507      #region digits
     508      var digits = new char[] {
     509        '#',
     510        'A',
     511        'B',
     512        'C',
     513        'D',
     514        'E',
     515        'F',
     516        'G',
     517        'H',
     518        'I',
     519        'J',
     520        'K',
     521        'L',
     522        'M',
     523        'N',
     524        'O',
     525        'P',
     526        'Q',
     527        'R',
     528        'S',
     529        'T',
     530        'U',
     531        'V',
     532        'W',
     533        'X',
     534        'Y',
     535        'Z'};
     536      int b = digits.Length - 1;
     537      #endregion
     538      string excelIndex = string.Empty;
     539      index = index + 1;
     540      while (index > 0) {
     541        int d = index / b;
     542        int rem = index % b;
     543        index = d;
     544        excelIndex = digits[rem] + excelIndex;
     545      }
     546      return excelIndex;
     547    }
     548
    482549    #region DataGridView virtual mode event handler
    483550
Note: See TracChangeset for help on using the changeset viewer.