Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Color Setting?

Posted on 2000-02-21
4
Medium Priority
?
371 Views
Last Modified: 2013-11-20
Hi All,

I want to know how can I set the background and text color of some dialogs such as CFileDialog, CColorDialog, etc. ???

I know there exists a function called SetDialogBkColor(..) to set the background and text color of the dialog created by us.

Further I also need to change the background and text color of the messagebox which is popped up by using the function AfxMessageBox.

Can I do both of this?

Thank you very much!!!

0
Comment
Question by:hon67
  • 2
4 Comments
 
LVL 1

Expert Comment

by:ScottyDawg
ID: 2541737
If you dreive a class from CFileDialog and handle the WM_CTLCOLOR message you should be able to set the background color to anything you like.

As far a MessageBoxes go though, I think you'd probably have to create you're own dialog class to handle it...
0
 
LVL 1

Accepted Solution

by:
Mensana earned 160 total points
ID: 2542766
0
 

Author Comment

by:hon67
ID: 2544409
Hi Mensana,

I have already used that sample code before. I found I need to declare a variable with the button in order to set its color.

How can I declare a variable with Open/Cancel/Save button in the CFileDialog/CColorDialog?

Thanks!!!
0
 
LVL 1

Expert Comment

by:Mensana
ID: 2547679
You have to derive your own class from CFileDialog. Include there the "colorbtn.h" header and attach two CColorButton variables to the IDCANCEL and IDOK buttons.
For some extra information take a look at the following articles:
In MSDN: Customize the Common Print Dialog Box - ID: Q132909;
On Web: http://www.codeguru.com/dialog/index.shtml – the “Common Dialogs” part of it.
You’ll find the dialog template for a common open file dialog box in “FILEOPEN.DLG” file. Move that template into your project resource file (“.rc”). Derive a class for that template from CDialog and then change it to CFileDialog so that it’ll behave the same (pay attention to the constructor). In your new class you can play with your buttons (IDOK and IDCANCEL) as much as you want.

Cheerz,
Mensana
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Integration Management Part 2
Suggested Courses
Course of the Month11 days, 16 hours left to enroll

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question