public DBschedule() { InitializeComponent(); this.Location = new Point(0, 1); PlannerDAO plannerDAO = PlannerDAO.getInstance(); plannerss = plannerDAO.SelectPlanner(); foreach (var item in plannerss) { WebRequest req = WebRequest.Create(item.Image); WebResponse resp = req.GetResponse(); imageList.ImageSize = new Size(64, 64); Stream stream = resp.GetResponseStream(); Image img = Image.FromStream(stream); imageList.Images.Add(item.Day + item.Name, img); } listView1.LargeImageList = imageList; listView1.SmallImageList = imageList; listView1.View = View.SmallIcon; List <string[]> strArray = new List <string[]>(); foreach (var item in plannerss) { strArray.Add(new string[] { item.Day + "일", item.Name }); } for (int j = 0; j < strArray.Count; j++) { ListViewItem listViewItem = new ListViewItem(strArray[j]); listView1.Items.Add(listViewItem); listView1.Items[j].ImageIndex = j; } }
public static PlannerDAO getInstance() { if (pd == null) { pd = new PlannerDAO(); } return(pd); }