selectitemform.cs

来自「I built the Superlist control whilst dev」· CS 代码 · 共 59 行

CS
59
字号
/////////////////////////////////////////////////////////////////////////////
//
// (c) 2007 BinaryComponents Ltd.  All Rights Reserved.
//
// http://www.binarycomponents.com/
//
/////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////
//
// (c) 2006 BinaryComponents Ltd.  All Rights Reserved.
//
// http://www.binarycomponents.com/
//
/////////////////////////////////////////////////////////////////////////////

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using BinaryComponents.SuperList;

namespace SuperListTest
{
	public partial class SelectItemForm : Form
	{
		public SelectItemForm( BinaryComponents.SuperList.ListControl listControl  )
		{
			InitializeComponent();
			_listControl.Columns.AddRange( listControl.Columns.ToArray() );
			_listControl.Items.AddRange( listControl.Items.ToArray() );
		}

		public object []SelectedItems;

		private void _selectButton_Click( object sender, EventArgs e )
		{
			if( _listControl.SelectedItems.Count > 0 )
			{
				List<object> items = new List<object>();
				this.SelectedItems = new object[_listControl.SelectedItems.Count];
				foreach( RowIdentifier ri in _listControl.SelectedItems )
				{
					items.AddRange( ri.Items );
				}
				this.SelectedItems = items.ToArray();
				this.DialogResult = DialogResult.OK;
			}
			else
			{
				this.DialogResult = DialogResult.Cancel;
			}
			this.Close();
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?