Click here to Skip to main content
15,925,723 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: newline in win xp Pin
Mike Nordell18-Jan-03 11:28
Mike Nordell18-Jan-03 11:28 
GeneralRe: newline in win xp Pin
SHaroz19-Jan-03 10:50
SHaroz19-Jan-03 10:50 
GeneralRe: newline in win xp Pin
Mike Nordell20-Jan-03 6:51
Mike Nordell20-Jan-03 6:51 
GeneralAdvanced WAV Manipulation Pin
EmilsHere18-Jan-03 11:15
EmilsHere18-Jan-03 11:15 
GeneralRe: Advanced WAV Manipulation Pin
gekoscan18-Jan-03 21:38
gekoscan18-Jan-03 21:38 
GeneralRepainting Pin
john john mackey18-Jan-03 9:05
john john mackey18-Jan-03 9:05 
GeneralRe: Repainting Pin
Daniel Ferguson19-Jan-03 17:10
Daniel Ferguson19-Jan-03 17:10 
GeneralRe: Repainting Pin
john john mackey20-Jan-03 6:47
john john mackey20-Jan-03 6:47 
Hi Daniel,

I modified my dialog's code to trap the WM_PAINT messages in OnPaint(), but I am still having problems initializing my dialog and the strange case when I do this to my MODELESS dialog:

1) place another window (dialog) object over my Color Swatch client area
keeping it over my Color Swatch
2) Set focus to my dialog with the Color Swatch -- don't move
3) Without moving either dialogs, toggle focus between the two

** the color swatch resorts back to the default (black) color.

Would you know what is going on and what I need to do?

Thanks.
Johnny

Here is what I have now:

//////////////////////////////////////////////////////
// CGraphicsParameters dialog -- .H

class CGraphicsParameters : public CDialog
{
// Other stuff left out for brevety

private:
// use to display colors as a sample swatch on the dialog
COLORREF m_ModelColor;
CRect m_ModelColorSwatch;

// Construction
public:
// use to display colors as a sample swatch on the dialog
void SetModelColorSwatch(COLORREF rgbColor);
}


//////////////////////////////////////////////////////
// CGraphicsParameters dialog -- .CPP

BOOL CGraphicsParameters::OnInitDialog()
{

CDialog::OnInitDialog();

// other dialog initialization goes here

// Initialize the color swatch rectangles - for later painting

// Calculate true location of the color swatch
// Get a pointer to CWnd
CWnd* pModelColor = GetDlgItem(IDC_MODEL_COLOR);
// Find its location on screen
pModelColor->GetWindowRect(&m_ModelColorSwatch);
// Store client coordinates
ScreenToClient(&m_ModelColorSwatch);
m_ModelColorSwatch.DeflateRect(2, 2, 1, 1); // for the sunken control setting

SetModelColorSwatch(m_ModelColor);

return TRUE;
}


void CGraphicsParameters::OnPaint()
{
SetModelColorSwatch(m_ModelColor);

CDialog::OnPaint();
}


// update the color swatch with the RGB color value
void CGraphicsParameters::SetModelColorSwatch(COLORREF rgbColor)
{
CBrush swatch;
swatch.CreateSolidBrush(rgbColor);
CClientDC dc(this);
dc.FillRect(&m_ModelColorSwatch, &swatch);
}

GeneralRe: Repainting Pin
Daniel Ferguson20-Jan-03 13:07
Daniel Ferguson20-Jan-03 13:07 
GeneralDLL help Pin
Jagruthi18-Jan-03 8:47
Jagruthi18-Jan-03 8:47 
GeneralRe: DLL help Pin
Stefan Pedersen18-Jan-03 10:14
Stefan Pedersen18-Jan-03 10:14 
GeneralRe: DLL help Pin
HENDRIK R20-Jan-03 1:53
HENDRIK R20-Jan-03 1:53 
GeneralRe: DLL help Pin
Anonymous20-Jan-03 5:01
Anonymous20-Jan-03 5:01 
GeneralRe: DLL help Pin
Jagruthi20-Jan-03 5:05
Jagruthi20-Jan-03 5:05 
GeneralRe: DLL help Pin
HENDRIK R20-Jan-03 21:40
HENDRIK R20-Jan-03 21:40 
QuestionTutorial on IE plugin? Pin
boaconstrictor18-Jan-03 7:43
boaconstrictor18-Jan-03 7:43 
AnswerRe: Tutorial on IE plugin? Pin
Neville Franks18-Jan-03 9:20
Neville Franks18-Jan-03 9:20 
AnswerRe: Tutorial on IE plugin? Pin
TigerNinja_18-Jan-03 12:59
TigerNinja_18-Jan-03 12:59 
AnswerRe: Tutorial on IE plugin? Pin
tonyschr18-Jan-03 22:46
tonyschr18-Jan-03 22:46 
Generalpassing iwebbrowser2 across threads Pin
khan200018-Jan-03 7:20
khan200018-Jan-03 7:20 
GeneralRe: passing iwebbrowser2 across threads Pin
Michael Dunn18-Jan-03 7:50
sitebuilderMichael Dunn18-Jan-03 7:50 
GeneralRe: passing iwebbrowser2 across threads Pin
geo_m18-Jan-03 23:53
geo_m18-Jan-03 23:53 
GeneralAccessing Controls Within Stacked Dialogs Pin
Aanidaani18-Jan-03 6:45
Aanidaani18-Jan-03 6:45 
GeneralRe: Accessing Controls Within Stacked Dialogs Pin
Gary R. Wheeler18-Jan-03 13:57
Gary R. Wheeler18-Jan-03 13:57 
GeneralRe: Accessing Controls Within Stacked Dialogs Pin
Aanidaani18-Jan-03 23:01
Aanidaani18-Jan-03 23:01 

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.