コード例 #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void textBox_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
 {
     try
     {
         if (this.row != -1 && this.col != -1)
         {
             if (e.KeyCode == Keys.Enter)
             {
                 this.Items[row].SubItems[col].Text = this.textBox.Text;
                 this.Focus();
                 propertyEventArgs pEv = new propertyEventArgs(this.Items[row].SubItems[0].Text, this.Items[row].SubItems[1].Text);
                 updateValue(sender, pEv);
             }
             else if (e.KeyCode == Keys.Escape)
             {
                 this.textBox.Text = this.Items[row].SubItems[col].Text;
                 this.Focus();
             }
         }
     }
     catch (Exception ex)
     {
         Trace.WriteLine(ex.ToString());
     }
 }
コード例 #2
0
 private void updateValue(object sender, propertyEventArgs e)
 {
     if (updateCell != null)
     {
         updateCell(sender, e);
     }
 }
コード例 #3
0
 /// <summary>
 /// This event handler wll set the current text in the combobox
 /// as the listview's current cell's text, while the combobox
 /// selection is changed
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void combo_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         if (this.row != -1 && this.col != -1)
         {
             if (this.Items[row].SubItems[col].Text != this.combo.Text)
             {
                 this.Items[row].SubItems[col].Text = this.combo.Text;
                 propertyEventArgs pEv = new propertyEventArgs(this.Items[row].SubItems[0].Text, this.Items[row].SubItems[1].Text);
                 updateValue(sender, pEv);
             }
             this.combo.Visible = !this.hideComboAfterSelChange;
         }
     }
     catch (Exception ex)
     {
         Trace.WriteLine(ex.ToString());
     }
 }
コード例 #4
0
 /// <summary>
 /// This event handler wll set the current text in the textbox
 /// as the listview's current cell's text, while the textbox
 /// focus is lost
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void textBox_Leave(object sender, EventArgs e)
 {
     try
     {
         if (this.row != -1 && this.col != -1)
         {
             if (this.Items[row].SubItems[col].Text != this.textBox.Text)
             {
                 this.Items[row].SubItems[col].Text = this.textBox.Text;
                 propertyEventArgs pEv = new propertyEventArgs(this.Items[row].SubItems[0].Text, this.Items[row].SubItems[1].Text);
                 updateValue(sender, pEv);
             }
             this.textBox.Hide();
         }
     }
     catch (Exception ex)
     {
         Trace.WriteLine(ex.ToString());
     }
 }
コード例 #5
0
 void combo_KeyUp(object sender, KeyEventArgs e)
 {
     try
     {
         if (this.row != -1 && this.col != -1 && e.KeyCode == Keys.Enter)
         {
             this.Items[row].SubItems[col].Text = this.combo.Text;
             this.combo.Hide();
             this.Focus();
             propertyEventArgs pEv = new propertyEventArgs(this.Items[row].SubItems[0].Text, this.Items[row].SubItems[1].Text);
             updateValue(sender, pEv);
         }
         else if (this.row != -1 && this.col != -1 && e.KeyCode == Keys.Escape)
         {
             this.combo.Hide();
             this.Focus();
         }
     }
     catch (Exception ex)
     {
         Trace.WriteLine(ex.ToString());
     }
 }