![]() |
Label Autoajusta Mal Hola... tengo un panel al cual, dentro de el, le ccreo unos labels. Estoy trabajando con una base de datos entonces hago un do loop dentro de los datos de la base y a partir de eso voy creando labels dinamicos para mostrar: titulo, fecha y noticia. El tema es el siguiente... la noticia puede tener poco texto como asi mucho texto, si le pongo autosize=true al label la noticia va a ser mostrada en 1 sola linea y se me va del panel, si le pongo autosize=false la noticia sale cortada porque el label es mas chica que la cantidad de texto que contiene para mostrar. En HTML uno puede crear una tabla que se autoajuste por porcentage, esto va a hacer que a medida que vos cambies el tamaño del browser esta se vaya autoajustando con todo su texto. Setear el anchor al lable no tiene sentido puesto que por mas anchor que ylo le ponga si el labe en su estado inicial no me muestra todas las lineas que debe tener no sirve de nada. Como puedo hacer para que un label de 100 pixeles de ancho se autoajuste hacia abajo???? Aca pego el codigo asi lo pueden ver: MasterConn.ConnectionString = MasterAccessConnect MasterConn.Open(MasterAccessConnect) MasterRs = New ADODB.Recordset MasterRs.Open("SELECT * FROM noticias where idcategoria=" & l.Tag, MasterConn, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic) Dim titulo() As Label Dim copete() As Label Dim fecha() As Label Dim sep() As Panel Dim ver() As Button Dim i As Integer i = -1 Do Until MasterRs.EOF Or MasterRs.BOF Or i = 10 i = i + 1 ReDim Preserve titulo(i) ReDim Preserve copete(i) ReDim Preserve fecha(i) ReDim Preserve sep(i) ReDim Preserve ver(i) fecha(i) = New Label fecha(i).Text = Format(MasterRs.Fields.Item("fecha").Value, "dd MMMM yyyy") fecha(i).Font = New System.Drawing.Font(fecha(i).Font, FontStyle.Bold) fecha(i).Font = New System.Drawing.Font("Microsoft Sans Serif", 8) sep(i) = New Panel ver(i) = New Button copete(i) = New Label copete(i).Anchor = AnchorStyles.Right copete(i).Anchor = AnchorStyles.Left copete(i).Anchor = AnchorStyles.Top copete(i).Text = MasterRs.Fields.Item("copete").Value & "dfsgsdfg sdg sdf g sdfg s dfg sd fg sdgf sd fg sdfgs dfg sdf g sdf g sdf gs dfg sd fg sdf g sdfg " copete(i).TextAlign = ContentAlignment.TopLeft '' '' copete(i).Size = New Size(Panel6.Width, copete(i).PreferredHeight) ''if copete(i).Width> '' copete(i).Font = New System.Drawing.Font(copete(i).Font, FontStyle.Bold) '' copete(i).Font = New System.Drawing.Font("Microsoft Sans Serif", 10) titulo(i) = New Label titulo(i).AutoSize = True titulo(i).Text = MasterRs.Fields.Item("titulo").Value titulo(i).Font = New System.Drawing.Font("Microsoft Sans Serif", 12) titulo(i).Font = New System.Drawing.Font(titulo(i).Font, FontStyle.Bold) sep(i).Width = Panel6.Width - 10 sep(i).Height = 2 sep(i).BackColor = System.Drawing.Color.FromArgb(0, 0, 0) ''(css(5)) '' titulo(i).Width = Panel6.Width fecha(i).AutoSize = True If i = 0 Then titulo(i).Top = Label6.Top + titulo(i).Height fecha(i).Top = titulo(i).Top + titulo(i).Height ''+ 2 copete(i).Top = fecha(i).Top + fecha(i).Height sep(i).Top = copete(i).Top + copete(i).Height + 5 End If If i <> 0 Then titulo(i).Top = sep(i - 1).Top + sep(i - 1).Height fecha(i).Top = titulo(i).Top + titulo(i).Height ''+ 2 copete(i).Top = fecha(i).Top + fecha(i).Height sep(i).Top = copete(i).Top + copete(i).Height End If '' AddHandler x(i).Click, AddressOf lclickb Panel6.Controls.Add(titulo(i)) Panel6.Controls.Add(fecha(i)) Panel6.Controls.Add(copete(i)) copete(i).Width = Panel6.Width copete(i).Size = New Size(Panel6.Width, copete(i).Text.Length) Panel6.Controls.Add(sep(i)) MasterRs.MoveNext() Loop '' MsgBox(i) MasterConn.Close() Panel6.Visible = True Muchas gracias |
| La zona horaria es GMT -6. Ahora son las 21:41. |
Desarrollado por vBulletin® Versión 3.8.7
Derechos de Autor ©2000 - 2026, Jelsoft Enterprises Ltd.