123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace Web
- {
- public partial class BookInfoExitRows_UI : Form
- {
- public BookInfoExitRows_UI()
- {
- InitializeComponent();
- }
- public BookInfoManager_UI Book = null;
- public ReaderManager_UI Reader = null;
- DataGridViewColumnCollection columns;
- private void BookInfoExitRows_UI_Load(object sender, EventArgs e)
- {
- if (Book != null)
- {
- columns = Book.dataGridView1.Columns;
- }
- else if (Reader != null)
- {
- columns = Reader.dgvHeaderInfo.Columns;
- }
- for (int i = 0; i < columns.Count - 2; i++)
- {
- if (columns[i].Visible == true)
- {
- listBox1.Items.Add(columns[i].HeaderText);
- }
- else
- {
- listBox2.Items.Add(columns[i].HeaderText);
- }
- }
- }
- //左移
- private void btnLeft_Click(object sender, EventArgs e)
- {
- ListBox.SelectedObjectCollection selectListBox2 = listBox2.SelectedItems;
- for (int i = 0; i < selectListBox2.Count; i++)
- {
- listBox1.Items.Add(selectListBox2[i]);
- for (int j = 0; j < columns.Count - 2; j++)
- {
- if (columns[j].HeaderText == selectListBox2[i].ToString())
- {
- columns[j].Visible = true;
- }
- }
- }
- ListBox.SelectedIndexCollection indices = listBox2.SelectedIndices;
- for (int i = indices.Count - 1; i >= 0; i--)
- {
- int index = indices[i];
- listBox2.Items.RemoveAt(index);
- }
- }
- //右移
- private void btnRight_Click(object sender, EventArgs e)
- {
- ListBox.SelectedObjectCollection selectListBox1 = listBox1.SelectedItems;
- for (int i = 0; i < selectListBox1.Count; i++)
- {
- listBox2.Items.Add(selectListBox1[i]);
- for (int j = 0; j < columns.Count - 2; j++)
- {
- if (columns[j].HeaderText == selectListBox1[i].ToString())
- {
- columns[j].Visible = false;
- }
- }
- }
- ListBox.SelectedIndexCollection indices = listBox1.SelectedIndices;
- for (int i = indices.Count - 1; i >= 0; i--)
- {
- int index = indices[i];
- listBox1.Items.RemoveAt(index);
- }
- }
- private void btnClose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- }
- }
|