Controles en ejecucion...
Publicado por CoquitoPe (19 intervenciones) el 27/04/2015 04:47:37
Un saludo ...
Por favor ayudenme en este código... porque sale error... o no se puede manejar matrices que crean controles en tiempo de ejecución...?
otra+ Al hacer click en un label creado (matLabel(intNum))... como lo identifico de los demás..?
Gracias...
Por favor ayudenme en este código... porque sale error... o no se puede manejar matrices que crean controles en tiempo de ejecución...?
otra+ Al hacer click en un label creado (matLabel(intNum))... como lo identifico de los demás..?
Gracias...
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
Private Sub NuevaForma()
Dim intConColum, intConFila, intNum, intContad As Integer
Dim sinAncho, sinAlto As Double
Dim sinAcumAncho, sinAcumAlto As VariantType
Dim strLeyenda, strFigura As String
Dim intColum, intFilas, intFigura As Integer
Do
strLeyenda = "Numero de Figuras : "
intFigura = InputBox(strLeyenda, "Formacion de Figuras", 3)
strLeyenda = strLeyenda & intFigura & Chr(13) & Chr(10) & "Numero de Columnas : "
intColum = InputBox(strLeyenda, "Formacion de Figuras", 6)
strLeyenda = strLeyenda & intColum & Chr(13) & Chr(10) & "Numero de Filas.... : "
intFilas = InputBox(strLeyenda, "Formacion de Figuras", 8)
If (intColum * intFilas / intFigura) <> Int(intColum * intFilas / intFigura) Then _
MsgBox(intColum & " x " & intFilas & " --> No es divisible para : " & intFigura & " figuras") : intColum = 0
Loop While intColum < 3 Or intFigura < 2 Or intFilas < 3
'----x-x-x-x-111
Dim intNumero As Integer
ReDim ramNumer(intColum * intFilas + 1)
intContad = 0
Dim ramNumDos As New Random
Dim intMatriz As Integer
For j As Integer = 1 To intColum
For i As Integer = 1 To intFilas
intContad = intContad + 1
Do
ramNumer(intContad) = ramNumDos.Next(1, intColum * intFilas + 1)
For intMatriz = 1 To intContad - 1
If ramNumer(intContad) = ramNumer(intMatriz) And intContad > 1 Then intMatriz = 0 : Exit For
Next
Loop While intMatriz = 0
Next
Console.Write("{0, 5}", ramNumer(intContad))
Next
ReDim matCarac(intColum * intFilas + 1)
'----x-x-x-x- 2222
intContad = 1
strFigura = Chr(65)
For j As Integer = 1 To intColum
For i As Integer = 1 To intFilas
matCarac(intContad) = strFigura
If intContad > 0 And intContad Mod intFigura = 0 Then strFigura = Chr(65 + intContad / intFigura)
intContad = intContad + 1
Next
Next
Dim TablePanel As New TableLayoutPanel
sinAncho = Int((1280 - intColum * 2) / intColum) : sinAlto = Int((760 - intFilas * 2) / intFilas)
TablePanel.ColumnCount = intColum
TablePanel.Dock = DockStyle.None
TablePanel.RowCount = intFilas
TablePanel.Width = 1280 : TablePanel.Height = 760
TablePanel.Left = 0 : TablePanel.Top = 0
TablePanel.BackColor = Color.Beige
TablePanel.AllowDrop = False
TablePanel.AutoScroll = False
TablePanel.ImeMode = Windows.Forms.ImeMode.NoControl
TablePanel.AutoSizeMode = Windows.Forms.AutoSizeMode.GrowOnly
TablePanel.CellBorderStyle = TableLayoutPanelCellBorderStyle.InsetDouble
Dim mLbl(intColum * intFilas) As Label
intNum = 0 : sinAcumAncho = 0 : sinAcumAlto = 0 : strFigura = Chr(65) '"A"
ReDim matLabel(intColum * intFilas)
For j As Integer = 1 To intColum
For i As Integer = 1 To intFilas
intNum = intNum + 1
Dim matLabel(intNum) As Label
stop
'---- Desde aquí la falla
matLabel(intNum).Text = matCarac(ramNumer(intNum))
matLabel(intNum).TextAlign = ContentAlignment.MiddleCenter
matLabel(intNum).Font = New System.Drawing.Font("Webdings", 45)
matLabel(intNumero).Dock = DockStyle.Fill
'matLabel(intnumero).AutoSize = True
matLabel(intNumero).Size = New System.Drawing.Size(sinAncho, sinAlto)
matLabel(intNumero).Location = New System.Drawing.Point(sinAcumAncho, sinAcumAlto)
sinAcumAncho = sinAcumAncho + sinAncho + 1 : sinAcumAlto = sinAcumAlto + sinAlto + 1
matLabel(intNumero).BackColor = Color.Blue
TablePanel.Controls.Add(matLabel(intNumero), j - 1, i - 1)
Next
Next
Me.Controls.Add(TablePanel)
Exit Sub
End Sub
Valora esta pregunta


0