Esempio n. 1
0
        private void AddDensityRange_Click(object sender, EventArgs e)
        {
            EditRange temp_editrange = new EditRange();

            if (temp_editrange.ShowDialog(this) == DialogResult.OK)
            {
                DensityRange temp_range = new DensityRange(temp_editrange.Edit_min, temp_editrange.Edit_max, temp_editrange.Red, temp_editrange.Green,
                                                           temp_editrange.Blue);
                int index = 0;
                if (_rangeList == null)
                {
                    return;
                }
                foreach (DensityRange r in _rangeList)
                {
                    if (temp_range.minValue < r.minValue)
                    {
                        break;
                    }
                    index++;
                }

                lstDensityRange.Items.Insert(index, temp_range.ToString());


                if (lstDensityRange.Items.Count > _rangeList.Count)
                {
                    _rangeList.Insert(index, temp_range);
                }
                else
                {
                    _rangeList[index] = temp_range;
                }
            }
        }
Esempio n. 2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (lstDensityRange.SelectedIndex >= 0)
            {
                DensityRange dr = _rangeList[lstDensityRange.SelectedIndex];
                GetMinMaxValue(ref dr);

                EditRange temp_editrange = new EditRange(dr);

                string list_text;
                temp_editrange.StartPosition = FormStartPosition.Manual;
                temp_editrange.Location      = new Point(this.Location.X + this.Width, this.Location.Y);
                if (temp_editrange.ShowDialog(this) == DialogResult.OK)
                {
                    DensityRange temp_range = new DensityRange(temp_editrange.Edit_min, temp_editrange.Edit_max, temp_editrange.Red, temp_editrange.Green,
                                                               temp_editrange.Blue);

                    if (lstDensityRange.Items.Count > _rangeList.Count)
                    {
                        _rangeList.Add(temp_range);
                    }
                    else
                    {
                        _rangeList[lstDensityRange.SelectedIndex] = temp_range;
                    }

                    list_text = temp_range.ToString();
                    lstDensityRange.Items[lstDensityRange.SelectedIndex] = list_text;
                }
            }
        }