Visual Basic.NET - Nuevamente... "Controles en matriz"

 
Vista:
sin imagen de perfil
Val: 17
Ha aumentado su posición en 8 puestos en Visual Basic.NET (en relación al último mes)
Gráfica de Visual Basic.NET

Nuevamente... "Controles en matriz"

Publicado por Audad (19 intervenciones) el 18/10/2016 02:04:24
Amigos foreros... de nuevo un saludo y perdonen por la persistencia...
Se pueden crear y manejar controles (labels) en matrices... en ejecucion...
Gracias por los comentarios... links o algo que me oriente...
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil
Val: 17
Ha aumentado su posición en 8 puestos en Visual Basic.NET (en relación al último mes)
Gráfica de Visual Basic.NET

Nuevamente... "Controles en matriz"

Publicado por Audad (19 intervenciones) el 18/10/2016 20:18:51
Gracias Alfredo...
Ese es un codigo con controles en diseño... no es en ejecución como lo que deseo...
Insisto.. crear y manipular controles (en matriz) en ejecución...
Nuevamente gracias..-
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

Nuevamente... "Controles en matriz"

Publicado por khristian (17 intervenciones) el 18/10/2016 20:24:09
Si... debes crear nuevos objetos a partir de la clase label e instanciarlos... posicionarlos... darle valores a sus atributos... etc.

Si sabes crear un objeto de una clase... sabrás hacerlo...


Saludos
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 17
Ha aumentado su posición en 8 puestos en Visual Basic.NET (en relación al último mes)
Gráfica de Visual Basic.NET

Nuevamente... "Controles en matriz"

Publicado por Audad (19 intervenciones) el 18/10/2016 22:45:50
Khristian... gracias...
pero... se trata de crear objetos en matriz y en tiempo de ejecucion... me comentaron que se puede hacer en VB 6.00... en VB-NET ... no se puede... dudo que sacaran esa posibilidad...
Un saludo...
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 481
Bronce
Ha mantenido su posición en Visual Basic.NET (en relación al último mes)
Gráfica de Visual Basic.NET

Nuevamente... "Controles en matriz"

Publicado por Miguel (476 intervenciones) el 18/10/2016 23:25:54
En el enlace que te colocaron anteriormente explican cómo trabajar esto...
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 17
Ha aumentado su posición en 8 puestos en Visual Basic.NET (en relación al último mes)
Gráfica de Visual Basic.NET

Nuevamente... "Controles en matriz"

Publicado por Audad (19 intervenciones) el 19/10/2016 06:06:11
Khristian.... Gracias por el enlace... lo vi... pareciera una solucion..
lo analizare y te comentare...
Saludos y un deseo de bienestar
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 17
Ha aumentado su posición en 8 puestos en Visual Basic.NET (en relación al último mes)
Gráfica de Visual Basic.NET

Nuevamente... "Controles en matriz"

Publicado por Audad (19 intervenciones) el 21/10/2016 05:10:24
Amigos foreros,,, lo resolvi...
gracias a todos en especial a:
http://www.aprenderaprogramar.com/index.php?option=com_content&view=article&id=219:matrices-o-arrays-de-controles-arreglos-en-visual-basic-y-vbnet-concepto-y-ejemplo-de-codigo-cu00320a&catid=37:curso-qprogramacion-en-visual-basic-nivel-iq&Itemid=61

el codigo :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Public Class Form1
    Dim intFila, intColum, intTotal As Integer
    Dim intPunFila, intPunColum As Integer
    Dim intAncho, intAlto As Integer
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim i As Integer
        intFila = Val(InputBox("Numero de Filas", "MATRZ DE LABELS"))
        intColum = Int(1300 / 730 * intFila)
        intColum = Val(InputBox("Numero de Filas : " & intFila & vbCrLf & "Numero de Columnas", "MATRZ DE LABELS", intColum))
        intTotal = intFila * intColum
        intAncho = (1300 - intColum * 2) / intColum - 3 : intAlto = (730 - intFila * 2) / intFila
        Dim LabelArray(intTotal) As Label
        Dim TextBoxArray(intTotal) As TextBox
        intPunFila = 2 : intPunColum = 2
        For i = 1 To intTotal
            LabelArray(i) = New Label
            LabelArray(i).Text = i
            LabelArray(i).Width = intAncho
            LabelArray(i).Height = intAlto
            LabelArray(i).TextAlign = ContentAlignment.MiddleCenter
            LabelArray(i).BorderStyle = BorderStyle.FixedSingle
            LabelArray(i).Font = New Font("Arial", 8, FontStyle.Bold)
            intPunColum = intPunColum + intAncho + 2
            If (i - 1) Mod intColum = 0 Then intPunColum = 2 : intPunFila = intPunFila + intAlto + 2
            If i = 1 Then intPunColum = 2 : intPunFila = 2
            Me.Controls.Add(LabelArray(i))
            LabelArray(i).Location = New Point(intPunColum, intPunFila)
        Next
    End Sub
End Class
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
1
Comentar
sin imagen de perfil
Val: 17
Ha aumentado su posición en 8 puestos en Visual Basic.NET (en relación al último mes)
Gráfica de Visual Basic.NET

Nuevamente... "Controles en matriz"... nueva fase

Publicado por CoquitoPE (19 intervenciones) el 31/10/2016 00:29:08
Amigos foreros... de nuevo... un saludo... y ayuda por favor...
Al codigo anterior le agregue un evento Click...
pero... no puedo cambiar las propiedades de los controles creados en tiempo de ejecucion... no puedo poner un label(control) creado en diseño sobre el control que clickeo...
sugerencia y ayuda pf...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
'-----------------------------
Public Class Form1
    Dim intFila, intColum, intTotal, n As Integer
    Dim intPunFila, intPunColum As Integer
    Dim intAncho, intAlto, intFiguIni, intFiguFin As Integer
    Dim strArraySor() As String
    Dim intArraySor() As Integer
    Dim TextBoxArray() As Label = Nothing
    Dim LabelArray() As Label = Nothing
    Dim lblArraySor() As Label = Nothing
    Dim lblRespues() As Label = Nothing
    Dim strBien, strMensaje As String
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim intPot As Integer
        Dim intNive1 As Integer = 0
        Dim intNive2 As Integer = 0
        Dim intNive3 As Integer = 0
        Dim strFigu As String = Nothing
        Do
            intFila = Val(InputBox(strMensaje & vbCrLf & "Numero de Filas....... : ", "MATRIZ DE LABELS"))
            intColum = Int(1300 / 730 * intFila)
            strMensaje = strMensaje & "Numero de Filas....... : " & intFila & vbCrLf
            intColum = Val(InputBox(strMensaje & "Numero de Columnas : ", "MATRIZ DE LABELS", intColum))
            strMensaje = strMensaje & "Numero de Columnas : " & intColum & vbCrLf
            intTotal = intFila * intColum
            strMensaje = strMensaje & vbCrLf & "Total Cuadros : " & intTotal & vbCrLf
            intFiguIni = Val(InputBox(strMensaje & vbCrLf & "Numero de Figuras a buscar : ", "MATRIZ DE LABELS"))
            If intFila = 0 Or intColum = 0 Then
                strMensaje = "Datos Erroneos." & vbCrLf
            ElseIf intFiguIni >= intTotal Or (intTotal Mod intFiguIni) <> 0 Then
                intFiguIni = 0 : strMensaje = "No es divisible... TOTAL FIGURAS/fig a Buscar... REINICIAR" & vbCrLf
            ElseIf (intTotal / intFiguIni) > 27 ^ 3 Then
                strMensaje = "Combinacion MUY GRANDE (Total Cuadros/Figuras : " & (intTotal / intFiguIni) & vbCrLf & vbCrLf
            Else
                strMensaje = ""
            End If
        Loop While strMensaje <> ""
        intAncho = (1300 - intColum * 2) / intColum - 3 : intAlto = (730 - intFila * 2) / intFila
        ReDim LabelArray(intTotal)
        ReDim TextBoxArray(intTotal)
        ReDim strArraySor(intTotal)
        Do
            intPot = intPot + 1
            strFigu &= "A"
        Loop While (intTotal / intFiguIni) > 27 ^ intPot
        For i = 1 To intTotal
            If ((i - 1) Mod intFiguIni) = 0 Or i = 1 Then
                Select Case intPot
                    Case 1
                        strFigu = Chr(65 + intFiguFin)
                        intFiguFin += 1
                    Case 2
                        intNive1 += 1 ': If intNive1 > 26 Then Stop
                        If (intNive1 Mod 27) = 0 Then intNive2 += 1 : intNive1 = 1
                        strFigu = Chr(65 + intNive2) & Chr(64 + intNive1)
                    Case 3
                        intNive1 += 1
                        If (intNive1 Mod 27) = 0 Then
                            intNive2 += 1 : intNive1 = 1
                            If (intNive2 Mod 27) = 0 Then
                                intNive3 += 1 : intNive2 = 1
                            End If
                        End If
                        strFigu = Chr(65 + intNive3) & Chr(65 + intNive2) & Chr(64 + intNive1)
                End Select
            End If
            strArraySor(i) = strFigu
        Next
        Dim intRam As Integer
        Dim rnd As New Random()
        ReDim intArraySor(intTotal)
        For i = 1 To intTotal
            Do
                intRam = rnd.Next(1, intTotal + 1)
                For t = 1 To (i - 1)
                    If intRam = intArraySor(t) Or intRam = intTotal + 1 Then intRam = 0 : Exit For
                Next
            Loop While intRam = 0
            intArraySor(i) = intRam
        Next
        intPunFila = 2 : intPunColum = 2
        For i = 1 To intTotal
            LabelArray(i) = New Label
            LabelArray(i).Text = strArraySor(intArraySor(i))
            LabelArray(i).Width = intAncho
            LabelArray(i).Height = intAlto
            LabelArray(i).TextAlign = ContentAlignment.MiddleCenter
            LabelArray(i).BorderStyle = BorderStyle.FixedSingle
            LabelArray(i).Font = New Font("Arial", 8, FontStyle.Bold)
            intPunColum = intPunColum + intAncho + 2
            If (i - 1) Mod intColum = 0 Then intPunColum = 2 : intPunFila = intPunFila + intAlto + 2
            If i = 1 Then intPunColum = 2 : intPunFila = 2
            Me.Controls.Add(LabelArray(i))
            LabelArray(i).Location = New Point(intPunColum, intPunFila)
            AddHandler LabelArray(i).MouseClick, AddressOf LabelClick_MouseClick
        Next
    End Sub
    Private Sub LabelClick_MouseClick(ByVal sender As Object, ByVal e As MouseEventArgs)
        LblMuestra.Text = Mid(sender.ToString(), 35, 3)       'e.X & " : " & e.Y 
        LblMuestra.Height = intAlto : LblMuestra.Width = intAncho * 3
        LblMuestra.Location = New Point(e.X, e.Y)
    End Sub
End Class
'------------------------
GRACIAS
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar