Hi, I'm trying to make various MFC applications with edit controls using VS2005
when I noticed my professor's edit controls were flat, 2D with just a blue
border. I have no idea how to accomplish this. In VS2005, I open the
IDD_FORMVIEW and add an edit control with no static edge or anything, just
border set to true. In the designer and the "Test Dialog" mode, the control
looks correct: 2D, blue border, very simple. But when I build and run, the
blue border is gone and the edit control is now sunken and 3D. My professor has
no idea why his is different, since our edit controls use the same options. I
have also tried to do the exact same thing in VS2003 on a different computer,
with the same results (except not even the designer and the Test Dialog mode
show a 2D edit control, they show a 3D edit control).
i'm not sure if
this has something to do with winxp visual styles or something else. does
anyone have any ideas how to fix this I'm at the end of my wits, and I've
googled for several days now and tried every little option to change it.
The
only way I can even make a 2D edit control is to set static edge, border, and
client edge to false. But if I set border to false, I also lose the blue line
bordering the edit control (it essentially blends into the background
now).
Here's a picture of how his
looks:
his nice 2D one
and
here's how mine always comes out (notice how hard the 3D read-only edit control
is to see):
mine 3D nightmare

MFC edit control border
Coc Patrick
Hope the link I have provided the way to do the same
Serge_OD
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
try ot put it after this line.
LORD ORION
* WeelyTM impressed with Microsoft on that one.
so yes, w00t! it works now! Thanks so much. It seems like a less than finessed way of getting visual styles, but it works. I must consult with my professor to see if he knows anything of manifests and why his works automatically vs mine not.
Alvin Chen
See MSDN for Using Windows XP Visual Styles.
It will work fine.
HTH
gjutras
Link to ComCtl32.lib and call InitCommonControls.
I found InitCommonControlsEx is already called, but I'm not sure about linking to ComCtl32.lib, if its already done or if I have to put in some include line somewhere manually.
Also, step 3:
Add the manifest to your application's resource file as follows:
I view the code for the .rc file, but its quite large and I'm not sure
where to put this line.
Thanks for the help btw.
Mathew1972
James_Steven
#ifdef _UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
turning off unicode = turning off visual styles
aztec2_step
You can put it the manifest either with your executable or seperately.
if you put the your app.exe.manifest in your exe's path it will automatically loads if you called InitCommon controls.
else you may have to define it in the resource file (RC file).
normally the additional resources are defined in the rc2 file which is placed inside the "res" directory and also the manifest.
so you can give the complete path in rc file or rc2 file
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "res/SampleDialog.manifest"
else you may have to put it in the current directory