Dropdown-Button  
Author Message
gofrm





PostPosted: Visual C++ Express Edition, Dropdown-Button Top

Hi,

is there a win32 equivalent to the C# ControlPaint.DrawButton command
I'd like to create a window-theme-aware dropdown-button and i don't think that writing my own drawing-code for the WM_PAINT-handler is the right solution.

regards
Christian


Visual Studio Express Editions36  
 
 
nobugz





PostPosted: Visual C++ Express Edition, Dropdown-Button Top

ControlPaint.DrawButton() uses the DrawFrameControl() API function.


 
 
gofrm





PostPosted: Visual C++ Express Edition, Dropdown-Button Top

thanks for the quick reply,

that is the function i was looking for, but i am wondering what to do to make this function use xp-style. after including this "xp-style"-manifest file in the project all the other controls are painted in xp-style, but not the components that were painted by the DrawFrameControl()-function...


 
 
nobugz





PostPosted: Visual C++ Express Edition, Dropdown-Button Top

I played with ControlPaint a while ago and didn't see it use XP themes either. Does it for you



 
 
gofrm





PostPosted: Visual C++ Express Edition, Dropdown-Button Top

i don't know, i didn't use .NET's ControlPaint yet. I only read in the documentation that this function would paint controls and I was quite sure that it would do that in xp-style because every control in the .NET-framework use it.

but after reading a couple of howtos and tutorials, i found a solution to my problem:

HTHEME theme = OpenThemeData(hwnd,WC_COMBOBOX);
DrawThemeBackground(theme, hdc, CP_DROPDOWNBUTTON, CBXS_NORMAL, &rec2, NULL);
CloseThemeData(theme);

that will paint my dropdown-button in xp-style provided that this manifest-file is included in the project:

< xml version="1.0" encoding="UTF-8" standalone="yes" >
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="5.1.0.0"
processorArchitecture="X86"
name="win_server.exe"
type="win32" />
<description>WinServer</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*" />
</dependentAssembly>
</dependency>
</assembly>

but now, i don't what the corresponding .NET-function is....

regards
Christian