bonjour,
je cherche un moyen de supprimer l'ascenseur vertical d'une listBox personalisée, et d'ensuite le réafficher pour le reste de mon programme.
exist-il une fonction qui puisse cacher cet ascenseur?
merci
Version imprimable
bonjour,
je cherche un moyen de supprimer l'ascenseur vertical d'une listBox personalisée, et d'ensuite le réafficher pour le reste de mon programme.
exist-il une fonction qui puisse cacher cet ascenseur?
merci
salut,
il faut decocher l'option vertical scroll dans les ressources.
par programme :
faire un Invalidate() derriere .Code:
1
2
3 MyListBox.ModifyStyle(WS_VSCROLL,0); // enleve la scrollbar MyListBox.ModifyStyle(0,WS_VSCROLL); // remet la scrollbar
:D
je penses :)Code:
1
2 talistbox.ModifyStyle(WS_VSCROLL,0,0);
merci a vous deux, je testerai ça dès que possible.
:wink:
ha ben non ca marche pas,
j'ai decocher l'option, et quand j'appel
ca fait rien :(Code:
1
2 m_MyListBox.ModifyStyle(0,WS_VSCROLL); // remet la scrollbar Invalidate();
invalidate sur la listbox ...Citation:
Envoyé par mandagor
:D
bon ben j'ai essayé plein de truc
-option coché, j'ai essayer de l'afficher
-option décoché, j'ai essayer de la supprimer
avec des m_MyListBox.Invalidate() des RedrawWindow et autre UpdateWindow aussi bien sur ma CMylistbox que sur les Cwnd...
rien n'y fait c'est bizard!! :?
re, apparemment c'est pas possible
il faut recreer la listbox apres le changement de style.
donc on procedera par recopie des infos de l'objet a l'identique :
utilisationCode:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60 //--------------------------------------- BOOL CMyListBox::Recreate(LPVOID lpParam/*=0*/) { if (GetSafeHwnd() == NULL) return FALSE; CWnd* pParent = GetParent(); if (pParent == NULL) return FALSE; // get current attributes DWORD dwStyle = GetStyle(); DWORD dwStyleEx = GetExStyle(); CRect rc; GetWindowRect(&rc); pParent->ScreenToClient(&rc); // map to client co-ords UINT nID = GetDlgCtrlID(); CFont* pFont = GetFont(); CWnd* pWndAfter = GetNextWindow(GW_HWNDPREV); // get the currently selected text (and whether it is a valid list selection) CString sCurText; int nCurSel = GetCurSel(); BOOL bItemSelValid = nCurSel != -1; if (bItemSelValid) GetText(nCurSel, sCurText); CMyListBox listboxNew; if (! listboxNew.CreateEx(dwStyleEx, _T("ListBox"), _T(""), dwStyle, rc, pParent, nID, lpParam)) return FALSE; listboxNew.SetFont(pFont); int nNumItems = GetCount(); for (int n = 0; n < nNumItems; n++) { CString sText; GetText(n, sText); int nNewIndex = listboxNew.AddString(sText); listboxNew.SetItemData(nNewIndex,GetItemData(n)); } // re-set selected text if (bItemSelValid) listboxNew.SetCurSel(listboxNew.FindStringExact(-1, sCurText)); // destroy the existing window, then attach the new one DestroyWindow(); HWND hwnd = listboxNew.Detach(); Attach(hwnd); // position correctly in z-order SetWindowPos(pWndAfter == NULL ? &CWnd::wndBottom : pWndAfter, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); return TRUE; }
Note:j'ai mis a jour mon projet customlistbox sur mon domaine.Code:
1
2
3
4
5
6
7 void CCustomListBoxView::OnButtonscroll() { // TODO: Add your control notification handler code here m_CustomListBoxVar.ModifyStyle(m_bScroll?WS_VSCROLL:0,!m_bScroll?WS_VSCROLL:0); m_bScroll=!m_bScroll; m_CustomListBoxVar.Recreate(); }
:D
wahouuu :D
ca marche super, merci
avoir ton nivo en prog ca me fait rever :wink:
++
t'as plus qu'a bosser lol