Solved

Color Setting?

Posted on 2000-02-21
4
346 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 80 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
repeatEnd java challenge 42 84
Turn a spreadsheet into a vba executable. 2 87
Best tools for Backup and restore of Wordpress site 6 57
mapAB Challlenge 35 145
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

810 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