Datacombo stylexp

Résolu
cs_bename Messages postés 48 Date d'inscription samedi 18 juin 2005 Statut Membre Dernière intervention 24 mai 2007 - 4 oct. 2005 à 13:47
PCPT Messages postés 13272 Date d'inscription lundi 13 décembre 2004 Statut Membre Dernière intervention 3 février 2018 - 4 oct. 2005 à 14:21
Bonjour,
Je voudrai avoir la combobox de vb avec style de winXP
Merci


Bename

1 réponse

PCPT Messages postés 13272 Date d'inscription lundi 13 décembre 2004 Statut Membre Dernière intervention 3 février 2018 47
4 oct. 2005 à 14:21
attend au moins que ton précédent post ne soit plus visible sur la page d'accueil pour reposter l'identique!!!!
572032 http://www.vbfrance.com/forum.v2.aspx?ID=572032
je t'ai expliqué les différentes manières.
tu as opté pour des contrôles (à savoir ceux de Rey) et non le .manifest
ces contrôles ne contiennent pas la DataCombo.
il n'y a donc pas de solution.

tu peux juste, à la limite, appliquer une FlatScrollBar, ce qui changera le style, mais pas StyleXP pour autant.

ouvre un nouveau projet et colle y ce code.


Const WS_VSCROLL = &H200000
Const WS_HSCROLL = &H100000
Const GWL_STYLE = (-16)

Const WSB_PROP_CYVSCROLL = &H1
Const WSB_PROP_CXHSCROLL = &H2
Const WSB_PROP_CYHSCROLL = &H4
Const WSB_PROP_CXVSCROLL = &H8
Const WSB_PROP_CXHTHUMB = &H10
Const WSB_PROP_CYVTHUMB = &H20
Const WSB_PROP_VBKGCOLOR = &H40
Const WSB_PROP_HBKGCOLOR = &H80
Const WSB_PROP_VSTYLE = &H100
Const WSB_PROP_HSTYLE = &H200
Const WSB_PROP_WINSTYLE = &H400
Const WSB_PROP_PALETTE = &H800
Const WSB_PROP_MASK = &HFFF
Const FSB_FLAT_MODE = 2
Const FSB_ENCARTA_MODE = 1
Const FSB_REGULAR_MODE = 0

Const SB_HORZ = 0
Const SB_VERT = 1
Const SB_BOTH = 3

Const ESB_ENABLE_BOTH = &H0
Const ESB_DISABLE_BOTH = &H3
Const ESB_DISABLE_LEFT = &H1
Const ESB_DISABLE_RIGHT = &H2
Const ESB_DISABLE_UP = &H1
Const ESB_DISABLE_DOWN = &H2
Const ESB_DISABLE_LTUP = ESB_DISABLE_LEFT
Const ESB_DISABLE_RTDN = ESB_DISABLE_RIGHT

Const SIF_RANGE = &H1
Const SIF_PAGE = &H2
Const SIF_POS = &H4
Const SIF_ALL = (SIF_RANGE Or SIF_PAGE Or SIF_POS)

Private Type SCROLLINFO
cbSize As Long
fMask As Long
nMin As Long
nMax As Long
nPage As Long
nPos As Long
nTrackPos As Long
End Type
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long) As Long

Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Private Declare Function InitializeFlatSB Lib "comctl32" _
(ByVal hWnd As Long) As Long

Private Declare Function UninitializeFlatSB Lib "comctl32" _
(ByVal hWnd As Long) As Long

Private Declare Function FlatSB_SetScrollProp Lib "comctl32" _
(ByVal hWnd As Long, ByVal index As Long, ByVal newValue As Long, _
ByVal fRedraw As Boolean) As Boolean

Private Declare Function FlatSB_EnableScrollBar Lib "comctl32" _
(ByVal hWnd As Long, ByVal wSBflags As Long, ByVal wArrows As Long) As Long

Private Declare Function FlatSB_GetScrollInfo Lib "comctl32" _
(ByVal hWnd As Long, ByVal fnBar As Long, lpsi As SCROLLINFO) As Boolean

Private Declare Function FlatSB_GetScrollProp Lib "comctl32" _
(ByVal hWnd As Long, ByVal index As Long, pValue As Long) As Boolean

Private Declare Function FlatSB_GetScrollRange Lib "comctl32" _
(ByVal hWnd As Long, ByVal code As Long, lpMinPos As Long, _
lpMaxPos As Long) As Boolean

Private Declare Function FlatSB_SetScrollInfo Lib "comctl32" _
(ByVal hWnd As Long, ByVal fnBar As Long, lpsi As SCROLLINFO, _
ByVal fRedraw As Boolean) As Long

Private Declare Function FlatSB_SetScrollPos Lib "comctl32" _
(ByVal hWnd As Long, ByVal code As Long, ByVal nPos As Long, _
ByVal fRedraw As Boolean) As Long

Private Declare Function FlatSB_SetScrollRange Lib "comctl32" _
(ByVal hWnd As Long, ByVal code As Long, ByVal nMinPos As Long, _
ByVal nMaxPos As Long, ByVal fRedraw As Boolean) As Long

Private Declare Function FlatSB_ShowScrollBar Lib "comctl32" _
(ByVal hWnd As Long, ByVal code As Long, ByVal fShow As Boolean) As Boolean

Private Declare Function FlatSB_GetScrollPos Lib "comctl32" _
(ByVal hWnd As Long, ByVal code As Long) As Long

Private Sub Form_Activate()
Dim SI As SCROLLINFO
'Initialize
InitializeFlatSB Me.hWnd
'Set the vertical scrollbar to Encarta-mode
FlatSB_SetScrollProp Me.hWnd, WSB_PROP_VSTYLE, FSB_ENCARTA_MODE, False
'Disable the Up-button from the vertical scrollbar
FlatSB_EnableScrollBar Me.hWnd, SB_VERT, ESB_DISABLE_UP
'Set the vertical scroll range
FlatSB_SetScrollRange Me.hWnd, SB_VERT, 20, 80, False
'Set the scroll position to 50
FlatSB_SetScrollPos Me.hWnd, SB_VERT, 60, False
'Hide the horizontal scrollbar
FlatSB_ShowScrollBar Me.hWnd, SB_HORZ, False
'Get the scrollbar information
SI.cbSize = Len (SI)
SI.fMask = SIF_ALL
FlatSB_GetScrollInfo Me.hWnd, SB_VERT, SI
SI.nPos = SI.nPos - 10
'Set the new scrollbar information
FlatSB_SetScrollInfo Me.hWnd, SB_VERT, SI, True
'Show some scrollbar information on the form
Dim RetMin As Long, RetMax As Long
FlatSB_GetScrollRange Me.hWnd, SB_VERT, RetMin, RetMax
Me.AutoRedraw = True
Me.Print "Scroll Position:" + Str$( Int (100 * (FlatSB_GetScrollPos(Me.hWnd, SB_VERT) / RetMax))) + "%"
FlatSB_GetScrollProp Me.hWnd, WSB_PROP_VSTYLE, RetMin
Me.Print "Vertical Scrollbar Mode:" + Str$(RetMin)
End Sub
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
Dim Ret As Long
'Create the scrollbars on the form
Ret = GetWindowLong(Me.hWnd, GWL_STYLE)
Ret = Ret Or WS_VSCROLL Or WS_HSCROLL
SetWindowLong Me.hWnd, GWL_STYLE, Ret
End Sub
Private Sub Form_Unload(Cancel As Integer)
'Remove the Flat style
UninitializeFlatSB Me.hWnd
End Sub



<SMALL> Coloration syntaxique automatique [AFCK]</SMALL>


à toi d'adapter selon test besoins

PCPT
3
Rejoignez-nous