⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 listadapter.cs

📁 C#设计模式随书源码-Adapter模式实例程序
💻 CS
字号:
using System;
using System.Windows.Forms;

namespace LstAdapter
{
	/// <summary>
	/// Summary description for ListAdapter.
	/// </summary>
	public class ListAdapter 	{
		private ListBox listbox;	//operates on this one
		public ListAdapter(ListBox lb) 		{
			listbox = lb;
		}
		//-----
		public void Add(string s) {
			listbox.Items.Add (s);
		}
		//-----
        public void Add(Swimmer sw) {
			listbox.Items.Add (sw.getName()+"\t"+sw.getTime());
		}
		//-----
		public int SelectedIndex() {
			return listbox.SelectedIndex;
		}
		//-----
		public void Clear() {
			listbox.Items.Clear ();
		}
		//-----
		public void clearSelection() {
			int i = SelectedIndex();
			if(i >= 0) {
				listbox.SelectedIndex =-1;
			}
		}
	}
}

⌨️ 快捷键说明

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