Click here to Skip to main content
15,887,375 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
hi i've a CScrollBar object in my class. i create it by using its Create function. it appears and works well. but it's an old style (Windows 2000 theme) scrollbar. how can i replace it with a new style (Windows XP blue theme) scrollbar?

now i'm going to ask the same in another words and this time by depicting it also. a vertical scrollbar can be drawn with the same functionality in two different themes in Windows:
http://8208.6.img98.net/out.php/i194278_two-themes-of-vertical-scllbar.png[^]
when i use CScrollBar::Create it creates a scrollbar in the classic theme (left one), while i want it to be created in the new themed with visual effects (right one).
i hope i could clarify. sorry, my mother tongue is not English.
thx
Posted
Updated 25-Jan-12 9:11am
v2
Comments
Amir Mahfoozi 25-Jan-12 9:40am    
Winforms ? WPF ? Please specify.
ilostmyid2 25-Jan-12 10:00am    
pure C++
Sergey Alexandrovich Kryukov 25-Jan-12 14:14pm    
Not so helpful. You are supposed to tag your language, platform, type of application, UI library is applicable, explain your problem properly. Please use "Improve question" above.
--SA

Have a look at Using Windows XP Styles in your MFC/WIN32 Applications[^]

That should solve your problem :)

Best regards
Espen Harlinn
 
Share this answer
 
Comments
ilostmyid2 25-Jan-12 22:45pm    
thank you for the link. it was interesting. but it didn't solve the problem!
my application is tabbed MDI. the view class is derived from CScrollView instead of CView because i need it to scroll. the vertical and horizontal scrollbars of the view use Windows XP styles even without calling InitCommonControls. the scrollbar i'm talking about is what a grid ctrl creates when its content needs to be scrolled. it appears with style of Windows 2000 even if i call InitCommonControls in InitInstance of my application.
i couldn't find a clue :(
Espen Harlinn 26-Jan-12 6:19am    
Which grid control are you using?
ilostmyid2 26-Jan-12 6:41am    
CMFCPropertyGridCtrl
is there any other one?!
Espen Harlinn 26-Jan-12 6:52am    
Odd - that one uses a regular CScrollBar so the manifest should alter the appearance to XP style scrollbars ...
ilostmyid2 26-Jan-12 7:02am    
i looked at the source. it didn't do anything special. just created a CScrollBar by calling its Create member function. it means that wherever in my program i do the same i get a regular scrollbar, right? if so, we need the manifest for all applications which create a scrollbar, right?
i did what i had to, i think, about manifest. but it didn't change the look.
At the end of stdafx.h, add the following code:

#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")


Hope it helps.
 
Share this answer
 
v2
Comments
ilostmyid2 31-Jan-12 1:11am    
wow! thx :)
it solved the problem.
really thank u.
but let me know what does it do and what change does it cause?
ilostmyid2 31-Jan-12 1:40am    
oh! i found this line already in stdafx.h, but it's enclose in #ifdef _UNICODE region! what's the relation of unicode and new scrollbar style?! my project is not unicode. i must use old scrollbar style?!
ErnestoNet 31-Jan-12 8:37am    
You're welcome. I had the same problem in one of my applications. Tried the manifiest thing, didn't work.

So, I created two MFC Dialog test projects from scratch. In advanced features, there is a checkbox: "Common Control Manifiest". So, one with that checked and one with that unchecked.

Put some code to create a scrollbar on InitDialog and voila, in one it was XP style and the other not.

So, I compared the projects. Trust me, the file stdafx.h was the last one to check, but there it was. So:

The line is "wizard generated". I created another blank project (not unicode), and the line is exactly the same as the unicode version.

So, you can use XP style!!!

Note: It applies to all controls (list, textbox, etc), not only scrollbars.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900