private new void Show() { PanCla.Enabled = true; PanCla.Visible = true; PanMd1.Visible = false; PanMd2.Visible = false; PanelAdm.Visible = false; List<Panel> panels = new List<Panel>(); // here my list panels.Add(PanCla); panels.Add(PanMd1); panels.Add(PanMd2); panels.Add(PanelAdm); // i tryed this but not working to combining //foreach (Control p in panels.Controls) //{ // if (p is Button) // I need to talk to buton in list of panels. // { // var eli = new ElipseControl(); // eli.TargetControl = p; // eli.CornerRadius = 20; // } //} foreach (Control c in PanCla.Controls) { if (c is Button) { var el = new ElipseControl {TargetControl = c, CornerRadius = 20}; } } foreach (Control c in PanMd1.Controls) { if (c is Button) { var el = new ElipseControl {TargetControl = c, CornerRadius = 20}; } } foreach (Control c in PanMd2.Controls) { if (c is Button) { var el = new ElipseControl {TargetControl = c, CornerRadius = 20}; } } foreach (Control c in PanelAdm.Controls) { if (c is Button) { var el = new ElipseControl {TargetControl = c, CornerRadius = 20}; } } ElipseControl els = new ElipseControl(); els.TargetControl = this; els.CornerRadius = 20; els.TargetControl = label5; els.CornerRadius = 20; }
foreach (Panel panel in panels) { foreach (Control c in panel.Controls) { if (c is Button) { var el = new ElipseControl {TargetControl = c, CornerRadius = 20}; // But you need to do something with the el variable I think. } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)