how can add these label array named tile form? properties of actual label appearing in form should change change properties in code. can me out this?
using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; namespace piano_tiles { public partial class form1 : form { public label[] tile = new label[4]; public form1() { initializecomponent(); } private void form1_load(object sender, eventargs e) { (int i=0;i<4;i++) { tile[i] = new label(); tile[i].height = 200; tile[i].width = 100; tile[i].left = (i % 3) * 100; tile[i].top = * 200; tile[i].backcolor = color.black; tile[i].visible = true; } } } }
here are, should add control control collection of form:
private void form1_load(object sender, eventargs e) { (int = 0; < 4; i++) { tile[i] = new label(); tile[i].height = 200; tile[i].width = 100; tile[i].left = (i % 3) * 100; tile[i].top = * 200; tile[i].backcolor = color.black; tile[i].visible = true; controls.add(tile[i]); } } hope helps.
Comments
Post a Comment