public void Reposition() { _panel.SuspendLayout(); int count = _controlerLists.Count; int width = _panel.ClientSize.Width; int height = _panel.ClientSize.Height; List <Rectangle> rlist = new List <Rectangle>(); int xInterval = width / (2 * count + 1); for (int i = 0; i < count; i++) { IControler ctl = _controlerLists[i]; Control ctrl = ctl.GetControl(); if (ctrl == null) { continue; } ctrl.Top = (height - ctrl.Height) / 2; ctrl.Left = xInterval * (i * 2 + 1); ctrl.Width = xInterval; } _panel.ResumeLayout(); }
public void RemoveList(IControler list) { if (_controlerLists.Contains(list)) { list.Panel = null; list.ItemSelected -= new ItemSelectedHandler(list_ItemSelected); _controlerLists.Remove(list); Control ctrl = list.GetControl(); if (!_panel.Controls.Contains(ctrl)) { _panel.Controls.Add(ctrl); } } }
public void AddList(IControler list) { if (list == null) { return; } list.Panel = this; list.ItemSelected += new ItemSelectedHandler(list_ItemSelected); _controlerLists.Add(list); Control ctrl = list.GetControl(); if (ctrl != null) { _panel.Controls.Add(ctrl); ctrl.Visible = true; } }