Bonjour,
Pour mon travail je dois incorporer une télécommande dans l’application. Cette télécommande n’existe pas réellement c’est un composant logiciel et je ne sais vraiment pas comment la faire.
Cette télécommande aura différente boutons à sa surface, cela dépendra de la phase ou en sera l’application.
Pour être plus précis sur ce qu’est cette télécommande, je parle d’un composant logiciel qui ressemble a la télécomande à droite de l’image.
Quelqu’un a-t-il une idée de comment faire?
Euh … ou est le problème ? Suffit d’associer ce que ton appli est censée faire lors de l’appuie sur tel ou tel bouton, que cela ressemble à une télécommande ou pas, ça ne change pas de la programmation événementielle :neutre:
Le problème c’est que je dois donc le créer et le géré mais je ne vois pas comment faire:
est-ce que c’est considéré comme une fenêtre ou comme un control, si c’est control vais-je devoir le recréer à chaque fenêtre ou puis-je le garder actif pour toute les fenêtres et juste en modifié l’apparence.
C’est tous ça le problème et oui cela doit ressembler à une télécommande .
Perso, j’utiliserais un contrôle, c’est plus simple, maintenable et modifiable, il te suffit de setter/getter les options que tu souhaites (telle image pour telle bouton, telle police, tel évenement …), j’ai un vieux code VB pour naviguer ( premier/précédent/suivant/dernier ) :
''' <summary>
''' Contrôle personnalisé permettant la navigation dans n'importe
''' quel type de donnée (à la charge du contrôleur)
''' </summary>
''' <remarks>Ne pas oublier de regénérer la compilation en cas d'inclusion dans un nouveau projet</remarks>
Public Class ctlNavigation
Public Event premier(ByVal sender As Object)
Public Event dernier(ByVal sender As Object)
Public Event precedent(ByVal sender As Object)
Public Event suivant(ByVal sender As Object)
Public Property imagePremierText() As String
Get
Return btnPremier.Text
End Get
Set(ByVal value As String)
btnPremier.Text = value
End Set
End Property
Public Property imagePremierTextAlign() As Drawing.ContentAlignment
Get
Return btnPremier.TextAlign
End Get
Set(ByVal value As Drawing.ContentAlignment)
btnPremier.TextAlign = value
End Set
End Property
Public Property imagePremierTextImageRelation() As TextImageRelation
Get
Return btnPremier.TextImageRelation
End Get
Set(ByVal value As TextImageRelation)
btnPremier.TextImageRelation = value
End Set
End Property
Public Property imagePremier() As System.Drawing.Image
Get
Return btnPremier.BackgroundImage
End Get
Set(ByVal value As System.Drawing.Image)
btnPremier.BackgroundImage = value
btnPremier.Text = vbNullString
End Set
End Property
Public Property imagePremierAlign() As ContentAlignment
Get
Return btnPremier.ImageAlign
End Get
Set(ByVal value As ContentAlignment)
btnPremier.ImageAlign = value
End Set
End Property
Public Property imagePremierLayout() As ImageLayout
Get
Return btnPremier.BackgroundImageLayout
End Get
Set(ByVal value As ImageLayout)
btnPremier.BackgroundImageLayout = value
End Set
End Property
Public Property imagePremierAutosize() As Boolean
Get
Return btnPremier.AutoSize = True
End Get
Set(ByVal value As Boolean)
btnPremier.AutoSize = value
End Set
End Property
Public Property imagePremierSize() As Size
Get
Return btnPremier.Size
End Get
Set(ByVal value As Size)
btnPremier.Size = value
End Set
End Property
Public Property imagePremierLocation() As Point
Get
Return btnPremier.Location
End Get
Set(ByVal value As Point)
btnPremier.Location = value
End Set
End Property
Public Property couleurPremier() As System.Drawing.Color
Get
Return btnPremier.BackColor
End Get
Set(ByVal value As System.Drawing.Color)
btnPremier.BackColor = value
End Set
End Property
Public Property imageDernierText() As String
Get
Return btnDernier.Text
End Get
Set(ByVal value As String)
btnDernier.Text = value
End Set
End Property
Public Property imageDernierTextAlign() As Drawing.ContentAlignment
Get
Return btnDernier.TextAlign
End Get
Set(ByVal value As Drawing.ContentAlignment)
btnDernier.TextAlign = value
End Set
End Property
Public Property imageDernierTextImageRelation() As TextImageRelation
Get
Return btnDernier.TextImageRelation
End Get
Set(ByVal value As TextImageRelation)
btnDernier.TextImageRelation = value
End Set
End Property
Public Property imageDernier() As System.Drawing.Image
Get
Return btnDernier.BackgroundImage
End Get
Set(ByVal value As System.Drawing.Image)
btnDernier.BackgroundImage = value
btnDernier.Text = vbNullString
End Set
End Property
Public Property imageDernierAlign() As ContentAlignment
Get
Return btnDernier.ImageAlign
End Get
Set(ByVal value As ContentAlignment)
btnDernier.ImageAlign = value
End Set
End Property
Public Property imageDernierLayout() As ImageLayout
Get
Return btnDernier.BackgroundImageLayout
End Get
Set(ByVal value As ImageLayout)
btnDernier.BackgroundImageLayout = value
End Set
End Property
Public Property imageDernierAutosize() As Boolean
Get
Return btnDernier.AutoSize = True
End Get
Set(ByVal value As Boolean)
btnDernier.AutoSize = value
End Set
End Property
Public Property imageDernierSize() As Size
Get
Return btnDernier.Size
End Get
Set(ByVal value As Size)
btnDernier.Size = value
End Set
End Property
Public Property imageDernierLocation() As Point
Get
Return btnDernier.Location
End Get
Set(ByVal value As Point)
btnDernier.Location = value
End Set
End Property
Public Property couleurDernier() As System.Drawing.Color
Get
Return btnDernier.BackColor
End Get
Set(ByVal value As System.Drawing.Color)
btnDernier.BackColor = value
End Set
End Property
Public Property imagePrecedentText() As String
Get
Return btnPrecedent.Text
End Get
Set(ByVal value As String)
btnPrecedent.Text = value
End Set
End Property
Public Property imagePrecedentTextAlign() As Drawing.ContentAlignment
Get
Return btnPrecedent.TextAlign
End Get
Set(ByVal value As Drawing.ContentAlignment)
btnPrecedent.TextAlign = value
End Set
End Property
Public Property imagePrecedentTextImageRelation() As TextImageRelation
Get
Return btnPrecedent.TextImageRelation
End Get
Set(ByVal value As TextImageRelation)
btnPrecedent.TextImageRelation = value
End Set
End Property
Public Property imagePrecedent() As System.Drawing.Image
Get
Return btnPrecedent.BackgroundImage
End Get
Set(ByVal value As System.Drawing.Image)
btnPrecedent.BackgroundImage = value
btnPrecedent.Text = ""
End Set
End Property
Public Property imagePrecedentAlign() As ContentAlignment
Get
Return btnPrecedent.ImageAlign
End Get
Set(ByVal value As ContentAlignment)
btnPrecedent.ImageAlign = value
End Set
End Property
Public Property imagePrecedentLayout() As ImageLayout
Get
Return btnPrecedent.BackgroundImageLayout
End Get
Set(ByVal value As ImageLayout)
btnPrecedent.BackgroundImageLayout = value
End Set
End Property
Public Property imagePrecedentAutosize() As Boolean
Get
Return btnPrecedent.AutoSize = True
End Get
Set(ByVal value As Boolean)
btnPrecedent.AutoSize = value
End Set
End Property
Public Property imagePrecedentSize() As Size
Get
Return btnPrecedent.Size
End Get
Set(ByVal value As Size)
btnPrecedent.Size = value
End Set
End Property
Public Property imagePrecedentLocation() As Point
Get
Return btnPrecedent.Location
End Get
Set(ByVal value As Point)
btnPrecedent.Location = value
End Set
End Property
Public Property couleurPrecedent() As System.Drawing.Color
Get
Return btnPrecedent.BackColor
End Get
Set(ByVal value As System.Drawing.Color)
btnPrecedent.BackColor = value
End Set
End Property
Public Property imageSuivantText() As String
Get
Return btnSuivant.Text
End Get
Set(ByVal value As String)
btnSuivant.Text = value
End Set
End Property
Public Property imageSuivantTextAlign() As Drawing.ContentAlignment
Get
Return btnSuivant.TextAlign
End Get
Set(ByVal value As Drawing.ContentAlignment)
btnSuivant.TextAlign = value
End Set
End Property
Public Property imageSuivantTextImageRelation() As TextImageRelation
Get
Return btnSuivant.TextImageRelation
End Get
Set(ByVal value As TextImageRelation)
btnSuivant.TextImageRelation = value
End Set
End Property
Public Property imageSuivant() As System.Drawing.Image
Get
Return btnSuivant.BackgroundImage
End Get
Set(ByVal value As System.Drawing.Image)
btnSuivant.BackgroundImage = value
btnSuivant.Text = vbNullString
End Set
End Property
Public Property imageSuivantAlign() As ContentAlignment
Get
Return btnSuivant.ImageAlign
End Get
Set(ByVal value As ContentAlignment)
btnSuivant.ImageAlign = value
End Set
End Property
Public Property imageSuivantLayout() As ImageLayout
Get
Return btnSuivant.BackgroundImageLayout
End Get
Set(ByVal value As ImageLayout)
btnSuivant.BackgroundImageLayout = value
End Set
End Property
Public Property imageSuivantAutosize() As Boolean
Get
Return btnSuivant.AutoSize = True
End Get
Set(ByVal value As Boolean)
btnSuivant.AutoSize = value
End Set
End Property
Public Property imageSuivantSize() As Size
Get
Return btnSuivant.Size
End Get
Set(ByVal value As Size)
btnSuivant.Size = value
End Set
End Property
Public Property imageSuivantLocation() As Point
Get
Return btnSuivant.Location
End Get
Set(ByVal value As Point)
btnSuivant.Location = value
End Set
End Property
Public Property couleurSuivant() As System.Drawing.Color
Get
Return btnSuivant.BackColor
End Get
Set(ByVal value As System.Drawing.Color)
btnSuivant.BackColor = value
End Set
End Property
Public Sub btnPremier_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPremier.Click
RaiseEvent premier(Me)
End Sub
Public Sub btnPrecedent_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrecedent.Click
RaiseEvent precedent(Me)
End Sub
Public Sub btnSuivant_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSuivant.Click
RaiseEvent suivant(Me)
End Sub
Public Sub btnDernier_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDernier.Click
RaiseEvent dernier(Me)
End Sub
Private Sub ctlNavigation_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
btnPremier.Font = New Font("Microsoft Sans Serif", 8.25, FontStyle.Regular, GraphicsUnit.Point)
btnSuivant.Font = New Font("Microsoft Sans Serif", 8.25, FontStyle.Regular, GraphicsUnit.Point)
btnDernier.Font = New Font("Microsoft Sans Serif", 8.25, FontStyle.Regular, GraphicsUnit.Point)
btnPrecedent.Font = New Font("Microsoft Sans Serif", 8.25, FontStyle.Regular, GraphicsUnit.Point)
End Sub
End Class