Événement Section.Paint (Access)
Se produit lorsque la section spécifiée est de nouveau tracée.
Syntaxe
expression. Peinture
Expression Variable qui représente un objet Section .
Exemple
L’exemple suivant montre comment définir la propriété BackColor d’un contrôle en fonction de sa valeur.
Private Sub SetControlFormatting()
If (Me.AvgOfRating >= 8) Then
Me.AvgOfRating.BackColor = vbGreen
ElseIf (Me.AvgOfRating >= 5) Then
Me.AvgOfRating.BackColor = vbYellow
Else
Me.AvgOfRating.BackColor = vbRed
End If
End Sub
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
' size the width of the rectangle
Dim lngOffset As Long
lngOffset = (Me.boxInside.Left - Me.boxOutside.Left) * 2
Me.boxInside.Width = (Me.boxOutside.Width * (Me.AvgOfRating / 10)) - lngOffset
' do conditional formatting for the control in print preview
SetControlFormatting
End Sub
Private Sub Detail_Paint()
' do conditional formatting for the control in report view
SetControlFormatting
End Sub
Assistance et commentaires
Avez-vous des questions ou des commentaires sur Office VBA ou sur cette documentation ? Consultez la rubrique concernant l’assistance pour Office VBA et l’envoi de commentaires afin d’obtenir des instructions pour recevoir une assistance et envoyer vos commentaires.
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour