Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Color Setting?

Posted on 2000-02-21
4
Medium Priority
?
367 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 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

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: 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…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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 you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

688 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