Solved

Color Setting?

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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 tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now