cs_Charlie
Messages postés110Date d'inscriptionjeudi 9 mai 2002StatutMembreDernière intervention11 mars 2010
-
22 mai 2002 à 18:02
cs_tonin63
Messages postés17Date d'inscriptionvendredi 17 mai 2002StatutMembreDernière intervention19 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!!!
Noxid
Messages postés78Date d'inscriptionlundi 13 mai 2002StatutMembreDerniè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 '*******'
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
cs_Charlie
Messages postés110Date d'inscriptionjeudi 9 mai 2002StatutMembreDernière intervention11 mars 20101 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!!!