Private void DrawGame () { Graphics g=CreateGraphics (); Pen Pen=new Pen (Color DarkOrange, 3); A Rectangle rMax=new Rectangle (195, 195, 210, 210); A Rectangle [] r=new Rectangle [16]. for (int i=0; I & lt; 16. I++) { R [I]. X=205 + (I % 4) * 50. R [I] Y=205 + (I/4) * 50. R [I]. Width=40; R [I]. Height=40; G.D rawRectangle (pen, r [I]); } G.D rawRectangle (pen, rMax);
}
Public void AddLabel () { for (int i=0; I & lt; 16. I++) { The Label l=new Label (); L.N ame="labNum_" + i.T oString (); L.F ont=new Font (" black ", 15); L.T ext="2"; L.L ocation=new Point (215 + (I % 4) * 50, 215 + (I/4) * 50); L.S considering=new Size (20, 20). This. Controls. The Add (l); } } How to add another function call control and modify properties of l l
CodePudding user response:
L.N ame="labNum_" + i.T oString (); In this case the You can use the
Label=l (form. Controls [" labNum_ digital "] as Label). L.T ext=XXX;
CodePudding user response:
If it is the individual controls, # 1, if it is full, it can be:
This. Controls. OfType
CodePudding user response:
I can in other functions such as DrawGame () used in labNum_ [I] Text="xx"; Modify its properties?