Using Owner drawn controls in Property Sheet/Enumerating Fon
Brad Larsen -- blarsen@icis.on.ca Sunday, December 01, 1996 Environment: VC++ 4.0, Win 95 I'm trying to design a font property page for a program I am writing. For changing the font color, I want to use a combo box with "colors". I used the Component Gallery to create a CColorCombo class and I can get the new combo box to work fine on an ordinary Dialog class (calling SubclassDlgItem) The problem is I can't get the thing to work in the Property Page. Where should the following code be placed in the CPropertyPage.cpp (mine's called CFontPage) file? (note: m_fontColorCombo = CColorCombo) // Subclass the font color combo and load the combo with the colors m_fontColorCombo.SubclassDlgItem(IDC_FONT_COLOR_COMBO, this); m_fontColorCombo.LoadList(); I've tried InitDialog, Create and just about every other message map in the class. Sometimes I get the Property Sheet to load, but the combo box is empty, other times I get Assertion failures on (m_hWnd != NULL) Thanks for any help Brad Larsen
Masanori Iwasa -- masa@aoistp.stpn.soft.net Tuesday, December 03, 1996 Brad, PropertyPages are same as dialog boxes, why don't you just subclass the control in the WM_INITDIALOG message ? I've done something simular with COlePropertyPage. If you send me a piece of code how your code looks it would help a lot better. Hopes this helps. Bunka Orient Co. Masa >---------- >From: Brad Larsen[SMTP:blarsen@icis.on.ca] >Sent: Sunday, December 01, 1996 8:51 PM >To: mfc-l@netcom.com >Subject: Using Owner drawn controls in Property Sheet/Enumerating >Fonts > >Environment: VC++ 4.0, Win 95 > >I'm trying to design a font property page for a program I am writing. >For >changing the font color, I want to use a combo box with "colors". I >used >the Component Gallery to create a CColorCombo class and I can get the >new >combo box to work fine on an ordinary Dialog class (calling >SubclassDlgItem) >The problem is I can't get the thing to work in the Property Page. > >Where should the following code be placed in the CPropertyPage.cpp >(mine's >called CFontPage) file? > >(note: m_fontColorCombo = CColorCombo) > >// Subclass the font color combo and load the combo with the colors >m_fontColorCombo.SubclassDlgItem(IDC_FONT_COLOR_COMBO, this); >m_fontColorCombo.LoadList(); > > >I've tried InitDialog, Create and just about every other message map in >the >class. > >Sometimes I get the Property Sheet to load, but the combo box is empty, >other times I get Assertion failures on (m_hWnd != NULL) > >Thanks for any help > >Brad Larsen > >
Hans Wedemeyer -- hansw@sprintmail.com Tuesday, December 03, 1996 Brad Larsen wrote: > > Environment: VC++ 4.0, Win 95 > > I'm trying to design a font property page for a program I am writing. I had a problem like this and found the solution in the book by Jeff Prosise "programming Windows 95 with MFC" Look for "Paint 7" page 648 it works fine if you are using the app as a stand alone. BUT, the menu does not paint when using it as an OLE object, that, although the menu works, colors can be selected, they are not painted. hope this helps regards Hans Wedemeyer
| Вернуться в корень Архива |