Newbie. I am not using a HDC control hadle to my dialog box, every code example for setting a text colour I have looked up uses one (e.g. SetTextColor( hDC, m_TextColor ).
Here is what I have working
// StatsDlg.cpp : implementation file
//
#include "stdafx.h"
#include "ACM.h"
#include "StatsDlg.h"
#include "QuickFilters.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CStatsDlg dialog
CStatsDlg::CStatsDlg(CWnd* pParent /*=NULL*/)
: CDialog(CStatsDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CStatsDlg)
m_pszDimensions = _T("-");
m_pszMean = _T("-");
m_pszMinMax = _T("-");
m_pszPixels = _T("-");
m_pszStdDev = _T("-");
// m_TextColor = RGB(255, 0, 0);
//}}AFX_DATA_INIT
m_pStatistics = NULL;
m_pStdDev = NULL;
}
void CStatsDlg:oDataExchange(CDataExchange* pDX)
{
CDialog:oDataExchange(pDX);
//{{AFX_DATA_MAP(CStatsDlg)
DDX_Text(pDX, IDC_DIMENSIONS, m_pszDimensions);
DDX_Text(pDX, IDC_MEAN, m_pszMean);
DDX_Text(pDX, IDC_MINMAX, m_pszMinMax);
DDX_Text(pDX, IDC_PIXELS, m_pszPixels);
DDX_Text(pDX, IDC_STDDEV, m_pszStdDev);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CStatsDlg, CDialog)
//{{AFX_MSG_MAP(CStatsDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CStatsDlg message handlers
BOOL CStatsDlg::OnInitDialog()
{
CDialog::OnInitDialog();
ASSERT(m_pStatistics && m_pStdDev);
CString format;
format.Format("%d um", m_pStatistics->x);
//SetTextColor(,RGB(0,128,0));
m_pszDimensions = format;
format.Format("%d um", m_pStatistics->y);
m_pszMean = format;
format.Format("%d um", m_pStatistics->pixels);
m_pszMinMax = format;
format.Format("%.3f", m_pStdDev->stddev);
m_pszStdDev = format;
UpdateData(FALSE);
return TRUE;
}
void CStatsDlg::SetStats(Statistics *ps, StdDev *psd)
{
m_pStatistics = ps;
m_pStdDev = psd;
}
Here is what I have working
// StatsDlg.cpp : implementation file
//
#include "stdafx.h"
#include "ACM.h"
#include "StatsDlg.h"
#include "QuickFilters.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CStatsDlg dialog
CStatsDlg::CStatsDlg(CWnd* pParent /*=NULL*/)
: CDialog(CStatsDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CStatsDlg)
m_pszDimensions = _T("-");
m_pszMean = _T("-");
m_pszMinMax = _T("-");
m_pszPixels = _T("-");
m_pszStdDev = _T("-");
// m_TextColor = RGB(255, 0, 0);
//}}AFX_DATA_INIT
m_pStatistics = NULL;
m_pStdDev = NULL;
}
void CStatsDlg:oDataExchange(CDataExchange* pDX)
{
CDialog:oDataExchange(pDX);
//{{AFX_DATA_MAP(CStatsDlg)
DDX_Text(pDX, IDC_DIMENSIONS, m_pszDimensions);
DDX_Text(pDX, IDC_MEAN, m_pszMean);
DDX_Text(pDX, IDC_MINMAX, m_pszMinMax);
DDX_Text(pDX, IDC_PIXELS, m_pszPixels);
DDX_Text(pDX, IDC_STDDEV, m_pszStdDev);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CStatsDlg, CDialog)
//{{AFX_MSG_MAP(CStatsDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CStatsDlg message handlers
BOOL CStatsDlg::OnInitDialog()
{
CDialog::OnInitDialog();
ASSERT(m_pStatistics && m_pStdDev);
CString format;
format.Format("%d um", m_pStatistics->x);
//SetTextColor(,RGB(0,128,0));
m_pszDimensions = format;
format.Format("%d um", m_pStatistics->y);
m_pszMean = format;
format.Format("%d um", m_pStatistics->pixels);
m_pszMinMax = format;
format.Format("%.3f", m_pStdDev->stddev);
m_pszStdDev = format;
UpdateData(FALSE);
return TRUE;
}
void CStatsDlg::SetStats(Statistics *ps, StdDev *psd)
{
m_pStatistics = ps;
m_pStdDev = psd;
}