Exemplo n.º 1
0
 private void dgvScaleLengths_CellParsing(object sender, DataGridViewCellParsingEventArgs e)
 {
     if (e.ColumnIndex == colScaleLength.Index)
     {
         var     rowStr = (SIString)dgvScaleLengths.Rows[e.RowIndex].DataBoundItem;
         Measure newValue;
         if (MeasureParser.TryParse((string)e.Value, out newValue, rowStr.ScaleLength.Unit))
         {
             e.Value          = newValue;
             e.ParsingApplied = true;
         }
     }
 }
Exemplo n.º 2
0
 private void dgvStrings_CellParsing(object sender, DataGridViewCellParsingEventArgs e)
 {
     if (dgvStrings[e.ColumnIndex, e.RowIndex].ValueType == typeof(Measure))
     {
         var     curValue = (Measure)dgvStrings[e.ColumnIndex, e.RowIndex].Value;
         Measure newValue;
         if (MeasureParser.TryParse((string)e.Value, out newValue, curValue.Unit))
         {
             e.Value          = newValue;
             e.ParsingApplied = true;
         }
     }
 }