[Resolu par Papou-net] Normal ou reduit Userform

Bearn 64

XLDnaute Occasionnel
Bonjour le Forum,

Une information est-il possible de réduire un userform a la taille d'un bouton. et de l'agrandir avec le même bouton.

Le bouton doit être de quelle nature command ou toggle ?????


Merci a tous de votre aide.
 

Pièces jointes

  • userform_normal.jpg
    userform_normal.jpg
    13.5 KB · Affichages: 40
  • userform_reduit.jpg
    userform_reduit.jpg
    18.5 KB · Affichages: 39
Dernière édition:

Papou-net

XLDnaute Barbatruc
Re : Normal ou reduit Userform

Bonjour Bearn 64,

Un bouton de commande simple peut faire l'affaire.

Voir sur fichier exemple en PJ.

Il te reste à adapter les dimensions des contrôles dans le code.

Cordialement.
 

Pièces jointes

  • Exemple Bearn 64.xlsm
    20.7 KB · Affichages: 37

Bearn 64

XLDnaute Occasionnel
Re : Normal ou reduit Userform

Bonjour Papou-net, le Forum.

je voudrais avoir le userform pleins écran.


Code:
Dim i As Byte, CBg As Integer, CBh As Integer, Lib
Dim UFl As Integer, UFh As Integer

Private Sub CommandButton1_Click()

Select Case i
  Case 0 'Réduire
    i = 1
    CommandButton1.Left = 2
    CommandButton1.Top = 2
    CommandButton1.Caption = Lib(1)
    Me.Width = 4 + CommandButton1.Width
    Me.Height = 28 + CommandButton1.Height
  Case 1 'Agrandir
    i = 0
    CommandButton1.Left = CBg
    CommandButton1.Top = CBh
    CommandButton1.Caption = Lib(0)
    Me.Width = UFl
    Me.Height = UFh

End Select


End Sub

Private Sub CommandButton9_Click()

UsfCommande.Show 0

End Sub

Private Sub UserForm_Initialize()
Lib = Array("Réduire", "Agrandir")
i = 0
UFl = Me.Width: UFh = Me.Height
CBg = CommandButton1.Left: CBh = CommandButton1.Top
CommandButton1.Caption = Lib(i)


With Me
.StartUpPosition = 1
.Width = Application.Width
.Height = Application.Height
.Left = 0
.Top = 0
End With


End Sub

A l'ouverture OK pleins écran.
Réduire et Agrandir le userform ne revient pas en pleins écran.

Merci de votre aide.

Bearn 64
 

Papou-net

XLDnaute Barbatruc
Re : [Resolu par Papou-net] Normal ou reduit Userform

Bonjour Bearn 64,

Il faut définir le mode plein écran dans l'initialisation du formulaire.

Code:
Private Sub UserForm_Initialize()
Lib = Array("Réduire", "Agrandir")
i = 0
With Me
  .Width = Application.Width - 10:  .Height = Application.Height - 10
  UFl = .Width: UFh = .Height
  CommandButton1.Left = .Width - CommandButton1.Width - 10
  CommandButton1.Top = .Height - CommandButton1.Height - 25
End With
CBg = CommandButton1.Left: CBh = CommandButton1.Top
CommandButton1.Caption = Lib(i)
End Sub
Bon dimanche dans le beau Béarn que j'apprécie.

Cordialement.
 

Pièces jointes

  • Exemple 01 Bearn 64.xlsm
    19.8 KB · Affichages: 30

Discussions similaires

Statistiques des forums

Discussions
314 223
Messages
2 107 498
Membres
109 844
dernier inscrit
odyn