ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
Google
 
Categories  >>  Software  >>  Programming Languages  >>  VC++  >>  MFC
 
 


 

 
 MFC interview questions  MFC Interview Questions
 ATL interview questions  ATL Interview Questions
 COM DCOM interview questions  COM DCOM Interview Questions
 Win32API interview questions  Win32API Interview Questions
 ActiveX interview questions  ActiveX Interview Questions
 VC++ AllOther interview questions  VC++ AllOther Interview Questions
Question
How can i change the color of a dropdowncombobox elements
 Question Submitted By :: K.ramaswamy
I also faced this Question!!     Rank Answer Posted By  
 
  Re: How can i change the color of a dropdowncombobox elements
Answer
# 1
to change color of all controls 
window message "WM_CTLCOLOR" needs to process 

in MFC this can be done by modifying OnCtlColor() 

eg.

HBRUSH CTestDlg::OnCtlColor(CDC* pDC, CWnd* pWnd,
                            UINT nCtlColor)
{
  HBRUSH hbr;

  switch (nCtlColor)
  {
  // process my edit controls by ID.
  case CTLCOLOR_EDIT:
  case CTLCOLOR_MSGBOX:
    switch (pWnd->GetDlgCtrlID())
    {
    // first CEdit control ID
    case IDC_MYCONTROLNAME1:
// put your own CONTROL ID here
      pDC->SetBkMode(TRANSPARENT);  // make text
                                    // background transparent
      pDC->SetTextColor(RGB(255,0,0));
// change the text color to red.
      hbr = (HBRUSH) GetStockObject(NULL_BRUSH);
// apply a null brush, so control's rectangle
// isn't filled.
      break;
// otherwise, do default handling of OnCtlColor
  default:
      hbr=CDialog::OnCtlColor(pDC,pWnd,nCtlColor);
  }

  return hbr;    // return brush
}

refer
http://www.codeguru.com/cpp/controls/editctrl/backgroundcolor/article.php/c3929/
for more information 
 
Is This Answer Correct ?    0 Yes 1 No
Sanjay20
 

 
 
 
Other MFC Interview Questions
 
  Question Asked @ Answers
 
What view class enables you to use an edit control as a view?  1
How many types of combo box are their E-Logic1
What is the difference between the Encapsulation and Abstraction Invensys9
In VC++ How to transfer between one exe to another exe while running.. Wipro4
What is the difference between hinsrtance and hprevinstance in WinMain function?  3
what is the component of CLR ? AZTEC3
how many types of messages are their E-Logic4
What is CSingleDocTemplate?  1
What is #progma and where it is used? L&T3
What is the size of class Aircom10
What is Multithreading Invensys1
1)why we cant create more than one instance of the class Derived from CWinApp  1
Hi All, I have created one MFC Dialog Based application.now if i am running the application its working fine,instead of closing he application i minimized the application,if i run the application again,i am getting the Dialog. I want to prevent the calling of application multiple times. please give me the code and let me know in which method i need to make changes. Praveer HP2
Difference between Debug and Release versions?  2
I can i set size of integer variable should be fixed for different operating systems(Ex i want integer size is 2bytes in OS) Invensys2
What four types of properties are supported by an ActiveX control?  1
if both base and derived class have the constructors if i create an object for derive class which class constructor is executed first Siemens5
Tell me the work of HTREDUCE and HTZOOM E-Logic1
How can i implement the dynamic menus in MFC plz give the code  2
What is difference between the TCP/IP and UDP socket Invensys2
 
For more MFC Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com