Solved

Color Setting?

Posted on 2000-02-21
4
360 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Suggested Courses

632 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