USUÁRIO:      SENHA:        SALVAR LOGIN ?    Adicione o VBWEB na sua lista de favoritos   Fale conosco 

 

  Fórum

  Visual Basic
Voltar
Autor Assunto:  Anexar Checkbox no MSFlexgrid. Como ?
dr.X
BELO HORIZONTE
MG - BRASIL
Postada em 16/02/2009 17:57 hs            
Moçada fera!
Como que eu coloco uma checkbox apenas na primeira coluna de uma msflexgrid ?
Desde já agradeço.
 
     
Treze
Pontos: 2843 Pontos: 2843
SÃO VICENTE
SP - BRASIL
Postada em 16/02/2009 19:07 hs            
tenta ai
 
Const strChecked = "þ"
Const strUnChecked = "q"
Private Sub Form_Load()
        With MSFlexGrid1
            .Rows = 10
            .Cols = 3
           
            .AllowUserResizing = flexResizeBoth
                       
            'Nome das Colunas
            For i = 1 To .Cols - 1
                .Row = 0
                .Col = i
                .Text = Chr(i + 64)
            Next i
           
            'Nome das Linhas
            For i = 1 To .Rows - 1
                .Col = 0
                .Row = i
                .Text = "Linha " & i
            Next i
                       
            'Define os campos como CheckBox
            For y = 1 To .Rows - 1
                    .Row = y
                    .Col = 0
                    .CellFontName = "Wingdings"
                    .CellFontSize = 14
                    .CellAlignment = flexAlignCenterCenter
                    .Text = strUnChecked
              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
TÓPICO EDITADO
   
Página(s): 1/1    


Seu Nome:

Seu eMail:

ALTERAR PARA MODO HTML
Mensagem:

[:)] = 
[:P] = 
[:(] = 
[;)] = 

HTML DESLIGADO

     
 VOLTAR

  



CyberWEB Network Ltda.    © Copyright 2000-2025   -   Todos os direitos reservados.
Powered by HostingZone - A melhor hospedagem para seu site
Topo da página