/// <summary>最大数変更ボタン押下時処理</summary> private void ctlDataSizeChangeButton_Click(object sender, EventArgs e) { using (var dialog = new DataSizeSettingDialog()) { dialog.MinimumDataSize = 0; dialog.DataSize = ctlDataList.Items.Count; if (dialog.ShowDialog() != DialogResult.OK) return; if (dialog.DataSize < ctlDataList.Items.Count) { for (int i = ctlDataList.Items.Count - 1; i >= dialog.DataSize; i--) { ctlDataList.Items.RemoveAt(i); } } else if (dialog.DataSize > ctlDataList.Items.Count) { for (int i = ctlDataList.Items.Count; i < dialog.DataSize; i++) { ctlDataList.Items.Add(""); } } } if (ctlDataList.SelectedIndex < 0 && ctlDataList.Items.Count > 0) { ctlDataList.SelectedIndex = 0; } }
/// <summary>最大数変更ボタン押下時処理</summary> private void ctlDataSizeChangeButton_Click(object sender, EventArgs e) { using (var dialog = new DataSizeSettingDialog()) { dialog.MinimumDataSize = 0; dialog.DataSize = ctlDataList.RowCount; if (dialog.ShowDialog() != DialogResult.OK) return; var dataSource = (DataTable)ctlDataList.DataSource; if (dialog.DataSize < dataSource.Rows.Count) { for (int i = dataSource.Rows.Count - 1; i >= dialog.DataSize; i--) { dataSource.Rows.RemoveAt(i); } } else if (dialog.DataSize > dataSource.Rows.Count) { for (int i = dataSource.Rows.Count; i < dialog.DataSize; i++) { dataSource.Rows.Add(""); } } } }
/// <summary>最大数変更ボタン押下時処理</summary> private void ctlDataSizeChangeButton_Click(object sender, EventArgs e) { using (var dialog = new DataSizeSettingDialog()) { dialog.MinimumDataSize = 0; dialog.DataSize = ctlItemEditor.Items.Count; if (dialog.ShowDialog() != DialogResult.OK) return; SuppressChecked = true; try { if (dialog.DataSize < ctlItemEditor.Items.Count) { for (int i = ctlItemEditor.Items.Count - 1; i >= dialog.DataSize; i--) { ctlItemEditor.Items.RemoveAt(i); } } else if (dialog.DataSize > ctlItemEditor.Items.Count) { for (int i = ctlItemEditor.Items.Count; i < dialog.DataSize; i++) { ctlItemEditor.Items.Add(String.Format("[{0}]", i), false); } } } finally { SuppressChecked = false; } } }
/// <summary>最大数変更ボタン押下時処理</summary> private void ctlDataSizeChangeButton_Click(object sender, EventArgs e) { using (var dialog = new DataSizeSettingDialog()) { dialog.DataSize = ArrayDatas.Count - 1; if (dialog.ShowDialog() != DialogResult.OK) return; ctlDataList.SelectedIndex = 0; if (dialog.DataSize < ArrayDatas.Count - 1) { for (int i = ArrayDatas.Count - 1; i > dialog.DataSize; i--) { ArrayDatas.RemoveAt(i); } } else if (dialog.DataSize > ArrayDatas.Count - 1) { for (int i = ArrayDatas.Count; i <= dialog.DataSize; i++) { var classData = CreateClassData(); classData.Variables["id"] = i; ArrayDatas.Add(classData); } } RefreshDataListItems(); ctlDataList.SelectedIndex = 0; } }