void aa_Click(object sender, EventArgs e) { JDF_UI.UC.UC_ProjectIco pico = (JDF_UI.UC.UC_ProjectIco)sender; selectedIdx = uc_p_list.IndexOf(pico); uC_FolderTree1.initwithRoot(pico.ProjectPath); resizeIco(); }
void resizeIco() { foreach(JDF_UI.UC.UC_ProjectIco pico in uc_p_list){ pico.Parent.Controls.Remove(pico); } uc_p_list.Clear(); var projects = File.ReadAllText(START_PATH + "\\userdata.txt").Split('?'); if (projects.Length<=0) { btn_add.Location = new Point(10, 10); return; } int idx = 0; int current_y = 10; foreach (string p in projects) { var uc_p = new JDF_UI.UC.UC_ProjectIco(); uc_p.initWithPath(p); uc_p.Click += aa_Click; panel1.Controls.Add(uc_p); if (idx == selectedIdx) { uc_p.selected(); uc_p.Location = new Point(4, current_y); uC_FolderTree1.Location = new Point(4, current_y + uc_p.Height); current_y += uC_FolderTree1.Height + uc_p.Height; } else { uc_p.Location = new Point(4, current_y); current_y = current_y + uc_p.Height + 10; } idx++; uc_p_list.Add(uc_p); } btn_add.Location = new Point(25, current_y); }
void resizeIco() { foreach (JDF_UI.UC.UC_ProjectIco pico in uc_p_list) { pico.Parent.Controls.Remove(pico); } uc_p_list.Clear(); var projects = File.ReadAllText(START_PATH + "\\userdata.txt").Split('?'); if (projects.Length <= 0) { btn_add.Location = new Point(10, 10); return; } int idx = 0; int current_y = 10; foreach (string p in projects) { var uc_p = new JDF_UI.UC.UC_ProjectIco(); uc_p.initWithPath(p); uc_p.Click += aa_Click; panel1.Controls.Add(uc_p); if (idx == selectedIdx) { uc_p.selected(); uc_p.Location = new Point(4, current_y); uC_FolderTree1.Location = new Point(4, current_y + uc_p.Height); current_y += uC_FolderTree1.Height + uc_p.Height; } else { uc_p.Location = new Point(4, current_y); current_y = current_y + uc_p.Height + 10; } idx++; uc_p_list.Add(uc_p); } btn_add.Location = new Point(25, current_y); }