Label2









How do I use Label2
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: frmThongTinNhom.cs Copy
34         private void label2_Click(object sender, EventArgs e)
35         {
36             this.Close();
37         }
File name: DialogUnity.cs Copy
41         public void setText(string line1, string line2)
42         {
43             bitmapFont = new BitmapFont("Fonts/shop_font", "Fonts/shop_font_xml", label1);
44             bitmapFont.setText(line1, 0, 15);
45             Transform[] fontTransforms = label1.GetComponentsInChildren(true);
46             for (int i = 0; i < fontTransforms.Length; i++)
47             {
48
49                 if (fontTransforms[i].gameObject.GetComponent() != null)
50                 {
51                     fontTransforms[i].gameObject.layer = LayerMask.NameToLayer("GUI");
52                     fontTransforms[i].gameObject.GetComponent().sortingLayerName = "GUI";
53                 }
54             }
55
56             BitmapFont bitmapFont2 = new BitmapFont(bitmapFont, label2);
57             bitmapFont2.setText(line2, 0, 15);
58             Transform[] fontTransforms2 = label2.GetComponentsInChildren(true);
59             for (int i = 0; i < fontTransforms2.Length; i++)
60             {
61                 if (fontTransforms2[i].gameObject.GetComponent() != null)
62                 {
63                     fontTransforms2[i].gameObject.layer = LayerMask.NameToLayer("GUI");
64                     fontTransforms2[i].gameObject.GetComponent().sortingLayerName = "GUI";
65                 }
66             }
67         }
File name: PurposeLabel.cs Copy
16         void Start()
17         {
18             BitmapFont purposeFont1 = new BitmapFont("Fonts/shop_font", "Fonts/shop_font_xml", purposeLabel1);
19             BitmapFont purposeFont2 = new BitmapFont(purposeFont1, purposeLabel2);
20             BitmapFont purposeFont3 = new BitmapFont(purposeFont1, purposeLabel3);
21
22             purposeFont1.setText("5th place or better : 50 #", 0, 12, "GUI", "GUI");
23             purposeFont2.setText("3rd place or better : 100 #", 0, 12, "GUI", "GUI");
24             purposeFont3.setText("1st place : 200 #", 0, 12, "GUI", "GUI");
25
26             purposeLabel1.transform.localScale = new Vector3(0.8f, 0.8f, purposeLabel1.transform.localScale.z);
27             purposeLabel2.transform.localScale = new Vector3(0.8f, 0.8f, purposeLabel2.transform.localScale.z);
28             purposeLabel3.transform.localScale = new Vector3(0.8f, 0.8f, purposeLabel3.transform.localScale.z);
29
30             int star = Data.getData(Data.KEY_STAR + (Attr.currentWorld * 15 + Attr.currentLevel));
31             for (int i = 0; i < 3; i++)
32             {
33                 if (i < star)
34                 {
35                     stars[i].GetComponent().sprite = starSprite;
36                 }
37             }
38
39         }
File name: frmColor.cs Copy
86   private void InitializeComponent()
87   {
88             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ColorInput));
89             this.Blue = new System.Windows.Forms.TextBox();
90             this.label4 = new System.Windows.Forms.Label();
91             this.Green = new System.Windows.Forms.TextBox();
92             this.label3 = new System.Windows.Forms.Label();
93             this.Red = new System.Windows.Forms.TextBox();
94            this.label2 = new System.Windows.Forms.Label();
95             this.label1 = new System.Windows.Forms.Label();
96             this.Cancel = new System.Windows.Forms.Button();
97             this.OK = new System.Windows.Forms.Button();
98             this.SuspendLayout();
99             //
100             // Blue
101             //
102             this.Blue.Location = new System.Drawing.Point(103, 112);
103             this.Blue.Name = "Blue";
104             this.Blue.Size = new System.Drawing.Size(100, 20);
105             this.Blue.TabIndex = 17;
106             ////
107             // label4
108             //
109             this.label4.ForeColor = System.Drawing.Color.Blue;
110             this.label4.Location = new System.Drawing.Point(32, 112);
111             this.label4.Name = "label4";
112             this.label4.Size = new System.Drawing.Size(32, 16);
113             this.label4.TabIndex = 16;
114             this.label4.Text = "Blue";
115            // //
116            // // Green
117            // //
118             this.Green.Location = new System.Drawing.Point(103, 80);
119             this.Green.Name = "Green";
120             this.Green.Size = new System.Drawing.Size(100, 20);
121             this.Green.TabIndex = 15;
122             //
123            // // label3
124            // //
125             this.label3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(255)))));
126             this.label3.Location = new System.Drawing.Point(32, 80);
127             this.label3.Name = "label3";
128             this.label3.Size = new System.Drawing.Size(32, 16);
129             this.label3.TabIndex = 14;
130             this.label3.Text = "Green";
131             //
132            // // Red
133            // //
134             this.Red.Location = new System.Drawing.Point(103, 48);
135             this.Red.Name = "Red";
136             this.Red.Size = new System.Drawing.Size(100, 20);
137             this.Red.TabIndex = 13;
138            // //
139            // // label2
140            // //
141             this.label2.ForeColor = System.Drawing.Color.Red;
142             this.label2.Location = new System.Drawing.Point(32, 48);
143             this.label2.Name = "label2";
144             this.label2.Size = new System.Drawing.Size(32, 16);
145             this.label2.TabIndex = 12;
146             this.label2.Text = "Red";
147             //
148            // // label1
149            // //
150             this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
151             this.label1.ForeColor = System.Drawing.Color.Blue;
152             this.label1.Location = new System.Drawing.Point(16, 16);
153             this.label1.Name = "label1";
154             this.label1.Size = new System.Drawing.Size(281, 24);
155             this.label1.TabIndex = 11;
156             this.label1.Text = "Nhập các giá trị màu từ -255 đến 255";
157             // this.label1.Click += new System.EventHandler(this.label1_Click);
158            // //
159            // // Cancel
160            // //
161             this.Cancel.Location = new System.Drawing.Point(176, 178);
162             this.Cancel.Name = "Cancel";
163             this.Cancel.Size = new System.Drawing.Size(75, 23);
164             this.Cancel.TabIndex = 9;
165             this.Cancel.Text = "Bỏ qua";
166             //
167            // // OK
168            // //
169             this.OK.Location = new System.Drawing.Point(19, 178);
170             this.OK.Name = "OK";
171             this.OK.Size = new System.Drawing.Size(75, 23);
172             this.OK.TabIndex = 10;
173             this.OK.Text = "Đồng ý";
174            // this.OK.Click += new System.EventHandler(this.OK_Click);
175             //
176             // ColorInput
177             //
178             this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
179             this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
180             this.ClientSize = new System.Drawing.Size(309, 226);
181             this.Controls.Add(this.Blue);
182             this.Controls.Add(this.label4);
183             this.Controls.Add(this.Green);
184             this.Controls.Add(this.label3);
185             this.Controls.Add(this.Red);
186             this.Controls.Add(this.label2);
187             this.Controls.Add(this.label1);
188             this.Controls.Add(this.OK);
189             this.Controls.Add(this.Cancel);
190             this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
191             this.Name = "ColorInput";
192             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
193             this.Text = "CHON MAU";
194             //this.Load += new System.EventHandler(this.ColorInput_Load);
195             this.ResumeLayout(false);
196             this.PerformLayout();
197
198   }
File name: frmLogin.cs Copy
229         private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
230         {
231             this.Hide();
232             frmCustomerRegistration frm = new frmCustomerRegistration();
233             frm.txtUsername.Text = "";
234             frm.txtPassword.Text = "";
235             frm.txtName.Text = "";
236             frm.txtContact_no.Text = "";
237             frm.txtEmail_Address.Text = "";
238             frm.txtUsername.Focus();
239             frm.Show();
240
241         }
File name: notepad1.cs Copy
386         private void label2_Click(object sender, EventArgs e)
387         {
388
389         }
File name: SpeechForm.cs Copy
42         private void label2_Click(object sender, EventArgs e)
43         {
44             this.Close();
45             notepad1 obj = new notepad1();
46             obj.Show();
47         }
File name: IndividualDetails.cs Copy
20         private void button1_Click(object sender, EventArgs e)
21         {
22
23             SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=F:\Sem.4\C# Projects\College management system\CollegeManagementSystem\SchoolManagementSystem\school.mdf;Integrated Security=True;User Instance=True");
24
25             con.Open();
26             if (textBox1.Text != "")
27             {
28                 try
29                 {
30                     string getCust = "select name,mother,gender,cast,mobile,email,dob,standard,medium,privious_school,year,address from student where std_id=" + Convert.ToInt32(textBox1.Text) + " ;"; // saving new custmer info
31
32                     SqlCommand cmd = new SqlCommand(getCust, con);
33                     SqlDataReader dr;
34                     dr = cmd.ExecuteReader();
35                     if (dr.Read())
36                     {
37                         label15.Text = dr.GetValue(0).ToString();
38                         label16.Text = dr.GetValue(1).ToString();
39                         label17.Text = dr.GetValue(2).ToString();
40                         label18.Text = dr.GetValue(3).ToString();
41                         label19.Text = dr.GetValue(4).ToString();
42                         label20.Text = dr.GetValue(5).ToString();
43                         label21.Text = dr.GetValue(6).ToString();
44                         label22.Text = dr.GetValue(7).ToString();
45                         label23.Text = dr.GetValue(8).ToString();
46                         label24.Text = dr.GetValue(9).ToString();
47                         label25.Text = dr.GetValue(10).ToString();
48                         label26.Text = dr.GetValue(11).ToString();
49                     }
50                     else
51                     {
52                         MessageBox.Show("Sorry '" + textBox1.Text + "' This Registration Id is Invalide, Please Insert Correct Id");
53                         textBox1.Text = "";
54
55                     }
56                 }
57                 catch (SqlException excep)
58                 {
59                     MessageBox.Show(excep.Message);
60                 }
61                 con.Close();
62             }
63         }
File name: frm_prev.cs Copy
44         private void frm_prev_Load(object sender, EventArgs e)
45         {
46             label1.Text = "Name : " + Name1;
47             label2.Text = "Nickname : " + Nickname;
48             label3.Text = "Phone Number : " + PhoneNumber;
49             label4.Text = "Mobile Number : " + MobileNumber;
50             label5.Text = "Email Address : " + EmailAddress;
51             label6.Text = "Home Address : " + HomeAddress;
52             label7.Text = "Company : " + Company;
53             label8.Text = "Position : " + Position;
54             label9.Text = "Group : " + GroupName;
55             label10.Text = "Website : " + Website;
56             label11.Text = "Facebook Account : " + FacebookAccount;
57         }

Label2 101 lượt xem

Gõ tìm kiếm nhanh...