Win32 Growing Pains
The hardest thing about Win32 is digging through MSDN to find out what they call it!! Im working with my first edit box and Im trying to do two things: change the font of the edit box, and apply a 3d border similar to the Address bar in IE to it. I tried the WS_BORDER style, but its just an ugly chunky frame. The 3d border in the Address bar is nice and cool with the two tone border. My edit box lives in an IE Tool Band so its important to me that it looks like the Address bar''s list box. I also want to change the font to be like the Address bar''s also. Currently the font is the same as the window title font. Im guessing thats 12 to 14 point which is much thicker than the prolly 10pt (arial?) that the Address bar has. I assume the font is a member of a struct somewhere, but I cant find it. Theres no SetFont() function either so Im up that creek for now.
There is no spoon.
December 21, 2000 04:17 PM
To set the font send the edit box a WM_SETFONT message.
For 3D borders use CreateWindowEx to create the window and add one of the WS_EX_xxxEDGE styles.
-Mike
For 3D borders use CreateWindowEx to create the window and add one of the WS_EX_xxxEDGE styles.
-Mike
Thanks for the all the help today Mike, its been great! I havent had a chance to play with the border thing yet, but Im having a little trouble with WM_SETFONT. The third param should be a handle to the font you want to set right? Well how do you get that handle? I found something called EnumFontFamiliesEx(), but it looks overly complex (must be the right one) to just select a damn font! If Im going about this wrong, please tell me! Ive been looking over MSDN all day and theres reall nothing that looks really good.... ok time to go play with EnumFont....
There is no spoon.
December 22, 2000 10:33 AM
Usually you get your HFONT by calling CreateFont. You''re right that it''s overly complex for what 90% of people want to do.
You can ask the user what they want by calling ChooseFont to throw up the standard font chooser dialog. Again, it''s pretty complex.
-Mike
You can ask the user what they want by calling ChooseFont to throw up the standard font chooser dialog. Again, it''s pretty complex.
-Mike
Thanks! I will have to check out that tut... As an FYI to Mike, those ...EDGE styles do not work in edit boxes anyway. =(
There is no spoon.
Speaking of those toolbands, how do u use them? The control looks cool, but i honestly can''t figure out. It would be icing on the delicious cake that is my programming project If someone could point me to a good link, or if they are verbose and a fast typer, maybe even explain it here?
BetaShare - Run Your Beta Right!
Hehe, each time I try to use those, I whish VC++ had an interface like VB for building my GUI.. but then in a game it''s a pretty mooth point ^_^
quote: Original post by Dark Rain
Hehe, each time I try to use those, I whish VC++ had an interface like VB for building my GUI.. but then in a game it''s a pretty mooth point ^_^
It does, but only for building dialog boxes. YOu just add a new resource file to your project and then go to the resources tab. Then add a dialog, and you''re all set.
My Geekcode: "GCS d s: a14 C++$ P+(++) L+ E-- W+++$ K- w++(+++) O---- M-- Y-- PGP- t X
R- tv+ b++ DI+(+++) D- G e* h!"
Decode my geekcode!
Geekcode.com
Visit our web site:
Asylum Entertainment
My Geekcode: "GCS d s: a14 C++$ P+(++) L+ E-- W+++$ K- w++(+++) O---- M-- Y-- PGP- t XR- tv+ b++ DI+(+++) D- G e* h!"Decode my geekcode!Geekcode.com
Visit our web site:Asylum Entertainment
Visit our web site:Asylum Entertainment
http://msdn.microsoft.com/workshop/browser/ext/overview/bands.asp
Dig in!
To Mike - I dont think youre able to change the font of the text in an edit box. If you''ve done it, please send me some sample code. I tried getting hFont from CreateFontIndirect(&logfont) but it only half works. After I create logfont, I can assign values to its members that work as criteria for the font required like strcpy(logfont.lfname, "Arial") and logfont.lfHeight = 12. Well if I specify anything less than 14 for the height, the default font in the edit box is clipped past 12 (in my example). So I can successfully change the height that the text SHOULD be drawn in, but not the font itself.
Dig in!
To Mike - I dont think youre able to change the font of the text in an edit box. If you''ve done it, please send me some sample code. I tried getting hFont from CreateFontIndirect(&logfont) but it only half works. After I create logfont, I can assign values to its members that work as criteria for the font required like strcpy(logfont.lfname, "Arial") and logfont.lfHeight = 12. Well if I specify anything less than 14 for the height, the default font in the edit box is clipped past 12 (in my example). So I can successfully change the height that the text SHOULD be drawn in, but not the font itself.
There is no spoon.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement