Home > Net > With code generation lable, how to register event for her?
With code generation lable, how to register event for her?
Time:09-30
With code generation lable, how to register event for her? For example: Label lable=new Label ();//the new lable For (int I=1; i <100; I++) { Lable. Name="lable" + I;//to lable named Lable. AutoSize=false; Lable. Location=new Point (2, 66); Lable. Size=new Size (298, 64); Lable. TextAlign=ContentAlignment. MiddleCenter; Lable. Text="haole"; Lable. The Font=new Font (" tahoma ", 15); Lable. BorderStyle=BorderStyle. Fixed3D; This. Controls. The Add (lable);//form to create a lable This. For the Location=new Point (lable. Location. X, lable. The Location, Y + 67);
} I want to give the new lable I registered click event, how do I register?
CodePudding user response:
Lable. The OnClick +=press Tab twice
CodePudding user response:
I just tried it on and registered the event, but I want to change the color of the lable, found no this control