Rendre une flexgrid dimensionnable sizable

Contenu du snippet

Bonjour,

Je cherchais la propriété "sizable" de ma flexgrid "MSFlexGrid", mais je n'ai rien trouvé... J'ai crée un bout de code qui simule l'aspect sizable de la liste...

On peut gérer la sensibilité de la souris avec la flexgrid
SENS_WIDTH = 300
SENS_HEIGHT = 600
SENS_BOTH = 300

Source / Exemple :


Private Sub MSFlexGrid_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
On Error Resume Next
    Screen.MousePointer = 0
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
On Error Resume Next
    Dim SENS_WIDTH, SENS_HEIGHT, SENS_BOTH As Integer
    Dim WIDTH, HEIGHT, BOTH, WAIT, NORMAL As Integer
    Dim who As Integer
    'définie la sensibilité
    SENS_WIDTH = 300
    SENS_HEIGHT = 600
    SENS_BOTH = 300
    'les pointeurs de souris
    WAIT = 11
    NORMAL = 0
    WIDTH = 9
    HEIGHT = 7
    BOTH = 8

    'par defaut on ne modifie rien
    who = NORMAL
    'on redimensionne la largeur de la flexgrid suivant la position de la souris
    If (x > (MSFlexGrid.WIDTH + MSFlexGrid.Left - SENS_WIDTH) And x < (MSFlexGrid.WIDTH + MSFlexGrid.Left + SENS_WIDTH) And y > MSFlexGrid.Top And y < (MSFlexGrid.HEIGHT + MSFlexGrid.Top + SENS_BOTH)) Then
        who = WIDTH
    End If
    'on redimensionne la hauteur de la flexgrid suivant la position de la souris
    If (y > (MSFlexGrid.HEIGHT + MSFlexGrid.Top - SENS_HEIGHT) And y < (MSFlexGrid.HEIGHT + MSFlexGrid.Top + SENS_HEIGHT) And x > MSFlexGrid.Top And x < (MSFlexGrid.WIDTH + MSFlexGrid.Left + SENS_BOTH)) Then
        If who <> WIDTH Then
            who = HEIGHT
        Else
            who = BOTH
        End If
    End If
    
    'traitement seulement lorsque le bouton clic gauche est enfoncé
    Screen.MousePointer = who
    If Button = 1 Then
        Select Case who
            Case HEIGHT
                MSFlexGrid.HEIGHT = y - MSFlexGrid.Top
            Case WIDTH
                MSFlexGrid.WIDTH = x - MSFlexGrid.Left
            Case BOTH
                MSFlexGrid.HEIGHT = y - MSFlexGrid.Top
                MSFlexGrid.WIDTH = x - MSFlexGrid.Left
        End Select
    End If
End Sub

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.