Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SetTextColor() with MFC Dialog Boxes?

Status
Not open for further replies.

eddiemjm

Programmer
Jan 28, 2004
4
IE
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::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(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;
}


 
How do I set the colour of the output strings in my dialog box?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top