System.Windows.Forms.Panel Controls.Add only see first July 27, 2013
Posted by juanpablo1manrique in SharePoint.Tags: .NET
trackback
Buen día amigos,
Aquí estoy realizando una aplicación Windows forms, pero en forms ciertas cosas funcionan diferente, me anime a escribir este post para todos aquellos que estamos acostumbrados a desarrollar WEB y nos encontramos con la necesidad de Hacer WindowsForms por casualidad.
Al ejecutar este código solo veía el primer control,
- Label lbl = new Label();
- lbl.Text = “sdfsdasdcsddf”;
- Panel12.Controls.Add(lbl);
- TextBox lbl3 = new TextBox();
- lbl3.Text = “1234 ABC”;
- Panel12.Controls.Add(lbl3);
- Label lbl2 = new Label();
- lbl2.Text = “123223”;
- Panel12.Controls.Add(lbl2);
Las solución para que en pantalla no se viera solo el primero fue agregar el location
- Label lbl = new Label();
- lbl.Text = “sdfsdasdcsddf”;
- lbl.Location = new System.Drawing.Point(0, 0);
- Panel12.Controls.Add(lbl);
- TextBox lbl3 = new TextBox();
- lbl3.Text = “1234 ABC”;
- lbl3.Location = new System.Drawing.Point(0, lbl.Size.Height);
- Panel12.Controls.Add(lbl3);
- Label lbl2 = new Label();
- lbl2.Text = “123223”;
- lbl2.Location = new System.Drawing.Point(0, lbl.Size.Height + lbl3.Size.Height);
- Panel12.Controls.Add(lbl2);
Happy WinForm Coding
Comments»
No comments yet — be the first.