SOLUCION CHECK BOX EN MSFlexGrid
Publicado por DIEGO (43 intervenciones) el 16/02/2007 19:35:29
CHECK BOX EN MSFlexGrid:
CODIGO COMPLETO
"NO SOY EL AUTOR DEL CODIGO"
'Written by Chris Pietschmann
'http://PietschSoft.itgo.com
Const strChecked = "þ"
Const strUnChecked = "q"
Private Sub Form_Load()
With MSFlexGrid1
.Rows = 10
.Cols = 3
.AllowUserResizing = flexResizeBoth
'nombre de las columnas
For i = 1 To .Cols - 1
.Row = 0
.Col = i
.Text = "Column " & i
Next i
'name the rows
For i = 1 To .Rows - 1
.Col = 0
.Row = i
.Text = "Row " & i
Next i
'define fields as checkbox
For y = 1 To .Rows - 1
For x = 1 To .Cols - 1
.Row = y
.Col = x
.CellFontName = "Wingdings"
.CellFontSize = 14
.CellAlignment = flexAlignCenterCenter
.Text = strUnChecked
Next x
Next y
End With
End Sub
Private Sub Form_Resize()
MSFlexGrid1.Width = Me.ScaleWidth
MSFlexGrid1.Height = Me.ScaleHeight
End Sub
Private Sub TriggerCheckbox(iRow As Integer, iCol As Integer)
With MSFlexGrid1
If .TextMatrix(iRow, iCol) = strUnChecked Then
.TextMatrix(iRow, iCol) = strChecked
Else
.TextMatrix(iRow, iCol) = strUnChecked
End If
End With
End Sub
Private Sub MSFlexGrid1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Or KeyAscii = 32 Then 'Enter/Space
With MSFlexGrid1
Call TriggerCheckbox(.Row, .Col)
End With
End If
End Sub
Private Sub MSFlexGrid1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 1 Then
With MSFlexGrid1
If .MouseRow <> 0 And .MouseCol <> 0 Then
Call TriggerCheckbox(.MouseRow, .MouseCol)
End If
End With
End If
End Sub
CODIGO COMPLETO
"NO SOY EL AUTOR DEL CODIGO"
'Written by Chris Pietschmann
'http://PietschSoft.itgo.com
Const strChecked = "þ"
Const strUnChecked = "q"
Private Sub Form_Load()
With MSFlexGrid1
.Rows = 10
.Cols = 3
.AllowUserResizing = flexResizeBoth
'nombre de las columnas
For i = 1 To .Cols - 1
.Row = 0
.Col = i
.Text = "Column " & i
Next i
'name the rows
For i = 1 To .Rows - 1
.Col = 0
.Row = i
.Text = "Row " & i
Next i
'define fields as checkbox
For y = 1 To .Rows - 1
For x = 1 To .Cols - 1
.Row = y
.Col = x
.CellFontName = "Wingdings"
.CellFontSize = 14
.CellAlignment = flexAlignCenterCenter
.Text = strUnChecked
Next x
Next y
End With
End Sub
Private Sub Form_Resize()
MSFlexGrid1.Width = Me.ScaleWidth
MSFlexGrid1.Height = Me.ScaleHeight
End Sub
Private Sub TriggerCheckbox(iRow As Integer, iCol As Integer)
With MSFlexGrid1
If .TextMatrix(iRow, iCol) = strUnChecked Then
.TextMatrix(iRow, iCol) = strChecked
Else
.TextMatrix(iRow, iCol) = strUnChecked
End If
End With
End Sub
Private Sub MSFlexGrid1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Or KeyAscii = 32 Then 'Enter/Space
With MSFlexGrid1
Call TriggerCheckbox(.Row, .Col)
End With
End If
End Sub
Private Sub MSFlexGrid1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 1 Then
With MSFlexGrid1
If .MouseRow <> 0 And .MouseCol <> 0 Then
Call TriggerCheckbox(.MouseRow, .MouseCol)
End If
End With
End If
End Sub
Valora esta pregunta


0