Click here to Skip to main content
15,898,869 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to show AVI file in a CDialog? Pin
vgrigor17-Feb-04 23:50
vgrigor17-Feb-04 23:50 
AnswerRe: How to show AVI file in a CDialog? Pin
Prakash Nadar18-Feb-04 2:06
Prakash Nadar18-Feb-04 2:06 
GeneralRe: How to show AVI file in a CDialog? Pin
vgrigor18-Feb-04 2:40
vgrigor18-Feb-04 2:40 
GeneralClistbox greying Pin
SVPG17-Feb-04 23:43
SVPG17-Feb-04 23:43 
GeneralRe: Clistbox greying Pin
sps-itsec4618-Feb-04 0:30
sps-itsec4618-Feb-04 0:30 
GeneralRe: Clistbox greying Pin
SVPG18-Feb-04 0:36
SVPG18-Feb-04 0:36 
GeneralRe: Clistbox greying Pin
Robert A. T. Káldy18-Feb-04 0:53
Robert A. T. Káldy18-Feb-04 0:53 
GeneralRe: Clistbox greying Pin
sps-itsec4618-Feb-04 1:29
sps-itsec4618-Feb-04 1:29 
As another poster said you can use the OnCtlColor() method for this. Assuming you have a button for changing between the grayed and not grayed state like this:
void CListBoxGrayingTestDlg::OnButtonGray() 
{
    // TODO: Add your control notification handler code here
	
    if(m_bGrayed)
    {
        m_bGrayed = FALSE;
        m_MyListBox.EnableWindow(TRUE);
    }
    else
    {
        m_bGrayed = TRUE;
        m_MyListBox.EnableWindow(FALSE);
    }
}
Adding a message handler for WM_CTLCOLOR you can now do something like this:
HBRUSH CListBoxGrayingTestDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
    HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
 
    // TODO: Change any attributes of the DC here
 
    // Set background transparent
    pDC->SetBkMode(TRANSPARENT);
 
    if (pWnd->GetDlgCtrlID() == IDC_MYLISTBOX)
    {
        if(m_bGrayed)
            return (HBRUSH)GetStockObject(GRAY_BRUSH);
        else
            return (HBRUSH)GetStockObject(WHITE_BRUSH);
    }
 
    // TODO: Return a different brush if the default is not desired
    return hbr;
}
Now the background will be grayed, when the control is disabled... Wink | ;)

Regards, mYkel
GeneralRe: Dialog application on TOP Pin
Robert A. T. Káldy17-Feb-04 23:36
Robert A. T. Káldy17-Feb-04 23:36 
GeneralRe: Dialog application on TOP Pin
neokialo17-Feb-04 23:47
neokialo17-Feb-04 23:47 
GeneralRotating a BitMap Pin
Pazzuzu17-Feb-04 23:13
Pazzuzu17-Feb-04 23:13 
GeneralRe: Rotating a BitMap Pin
TchouTchou Project18-Feb-04 2:52
TchouTchou Project18-Feb-04 2:52 
GeneralRe: Rotating a BitMap Pin
Pazzuzu18-Feb-04 2:55
Pazzuzu18-Feb-04 2:55 
GeneralQuestion on CEvent Pin
DimpleSurana17-Feb-04 22:14
DimpleSurana17-Feb-04 22:14 
GeneralRe: Question on CEvent Pin
Prakash Nadar17-Feb-04 22:20
Prakash Nadar17-Feb-04 22:20 
GeneralRe: Question on CEvent Pin
DimpleSurana17-Feb-04 22:27
DimpleSurana17-Feb-04 22:27 
GeneralRe: Question on CEvent Pin
DimpleSurana17-Feb-04 22:28
DimpleSurana17-Feb-04 22:28 
GeneralRe: Question on CEvent Pin
Prakash Nadar17-Feb-04 23:06
Prakash Nadar17-Feb-04 23:06 
GeneralRe: Question on CEvent Pin
DimpleSurana17-Feb-04 23:11
DimpleSurana17-Feb-04 23:11 
GeneralRe: Question on CEvent Pin
_Magnus_17-Feb-04 23:21
_Magnus_17-Feb-04 23:21 
GeneralRe: Question on CEvent Pin
DimpleSurana17-Feb-04 23:31
DimpleSurana17-Feb-04 23:31 
GeneralRe: Question on CEvent Pin
_Magnus_17-Feb-04 23:35
_Magnus_17-Feb-04 23:35 
GeneralRe: Question on CEvent Pin
DimpleSurana17-Feb-04 23:49
DimpleSurana17-Feb-04 23:49 
GeneralRe: Question on CEvent Pin
_Magnus_17-Feb-04 23:52
_Magnus_17-Feb-04 23:52 
GeneralRe: Question on CEvent Pin
DimpleSurana18-Feb-04 0:10
DimpleSurana18-Feb-04 0:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.