Label ou étiquette

cs_Charlie Messages postés 110 Date d'inscription jeudi 9 mai 2002 Statut Membre Dernière intervention 11 mars 2010 - 22 mai 2002 à 18:02
cs_tonin63 Messages postés 17 Date d'inscription vendredi 17 mai 2002 Statut Membre Dernière intervention 19 juillet 2002 - 23 mai 2002 à 09:42
Allo!

J'ai un fichier texte que je veux afficher a l'utilisateur. J'aimerais l'afficher de manière élégante en y incluant des colonnes. Comment faire???

Ce que je veux...

Pomme Poire Peche
Ananas Prune Biquette

(les colones sont alignées!!)

Ce que j'obtient en positionnant mon texte en fonction de la longueur des mots afficher. Mais deux mots de 8 caracteres ne prennent mas le meme espace a l'écran alors tout est croche!!!

Pomme Poire Peche
Ananas Prune Biquette

Merci!!!

4 réponses

Noxid Messages postés 78 Date d'inscription lundi 13 mai 2002 Statut Membre Dernière intervention 4 mai 2008
22 mai 2002 à 18:12
Je sais pas ca, mais pour mettre des marges (ce qui est également elegant). Copie ca:

Option Explicit

'*******' NE PAS COPIER CETTE API '********'
' API LIEN WEB
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
'*******' NE PAS COPIER CETTE API '********'

'*******' API A COPIER '*******'
Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
(ByVal hwndParent As Long, ByVal hwndChildAfter As Long, ByVal lpszClass As String, _
ByVal lpszWindow As String) As Long
'*******' API A COPIER '*******'

'*******' CONSTANTES A COPIER '*******'
Private Const EC_LEFTMARGIN = &H1
Private Const EC_RIGHTMARGIN = &H2
Private Const EC_USEFONTINFO = &HFFFF&
Private Const EM_SETMARGINS = &HD3&
Private Const EM_GETMARGINS = &HD4&
'*******' CONSTANTES A COPIER '*******'

Private Property Get EdithWnd(ByVal ctl As Control) As Long
If TypeName(ctl) = "ComboBox" Then
EdithWnd = FindWindowEx(ctl.hwnd, 0, "EDIT", vbNullString)
ElseIf TypeName(ctl) = "TextBox" Then
EdithWnd = ctl.hwnd
End If
End Property

Public Property Let RightMargin(ByVal ctl As Control, ByVal lMargin As Long)
Dim lhWnd As Long
lhWnd = EdithWnd(ctl)
If (lhWnd <> 0) Then
SendMessageLong lhWnd, EM_SETMARGINS, EC_RIGHTMARGIN, lMargin * &H10000
End If
End Property

Public Property Get RightMargin(ByVal ctl As Control) As Long
Dim lhWnd As Long
lhWnd = EdithWnd(ctl)
If (lhWnd <> 0) Then
RightMargin = SendMessageLong(lhWnd, EM_GETMARGINS, 0, 0) \ &H10000
End If
End Property

Public Property Let LeftMargin(ByVal ctl As Control, ByVal lMargin As Long)
Dim lhWnd As Long
lhWnd = EdithWnd(ctl)
If (lhWnd <> 0) Then
SendMessageLong lhWnd, EM_SETMARGINS, EC_LEFTMARGIN, lMargin
End If
End Property

Public Property Get LeftMargin(ByVal ctl As Control) As Long
Dim lhWnd As Long
lhWnd = EdithWnd(ctl)
If (lhWnd <> 0) Then
LeftMargin = (SendMessageLong(lhWnd, EM_GETMARGINS, 0, 0) And &HFFFF&)
End If
End Property

Private Sub Form_Load()
LeftMargin(Text1) = 50
RightMargin(Text1) = 50
LeftMargin(Combo1) = 10
LeftMargin(Combo2) = EC_USEFONTINFO
' Vous pouvez utiliser la constante EC_USERFONTINFO
' pour laisser les marges par défaut
End Sub
0
fredlynx Messages postés 662 Date d'inscription mercredi 16 janvier 2002 Statut Modérateur Dernière intervention 16 octobre 2010 3
22 mai 2002 à 18:55
insère des tabulation entre les mots ... je ne sais pas si ça marche ;) chr(9)

<center>http://www.lynx-asp.fr.st
WebMaster</center>
0
cs_Charlie Messages postés 110 Date d'inscription jeudi 9 mai 2002 Statut Membre Dernière intervention 11 mars 2010 1
22 mai 2002 à 19:45
Désolé.. les tabulations ne font qu'insérer des espaces plus long!!! Je crois qu'un tab est configuré comme 4 espaces mais sa dépend du OS et de la plate-forme de programmation! Quoi que chr(9) sur un clavier QWERTY ca fait pas du tout un tab!!!

Merci quand meme.
0
cs_tonin63 Messages postés 17 Date d'inscription vendredi 17 mai 2002 Statut Membre Dernière intervention 19 juillet 2002
23 mai 2002 à 09:42
Utilise une police a chasse fixe (genre fixedsys), tous des mots d'un meme nombre de lettres feront la meme longueur.

Pola
0
Rejoignez-nous