Click here to Skip to main content
15,919,931 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralWorker Thread Question! Pin
peter ho6-May-03 6:55
peter ho6-May-03 6:55 
GeneralRe: Worker Thread Question! Pin
jmkhael6-May-03 7:06
jmkhael6-May-03 7:06 
GeneralRe: Worker Thread Question! Pin
David Crow6-May-03 7:08
David Crow6-May-03 7:08 
GeneralRe: Worker Thread Question! Pin
valikac6-May-03 8:52
valikac6-May-03 8:52 
GeneralChange CProgressCtrl´s color Pin
VietDelphi6-May-03 6:27
VietDelphi6-May-03 6:27 
GeneralRe: Change CProgressCtrl´s color Pin
Michael Pauli6-May-03 6:35
Michael Pauli6-May-03 6:35 
GeneralRe: Change CProgressCtrl´s color Pin
VietDelphi6-May-03 6:43
VietDelphi6-May-03 6:43 
GeneralRe: Change CProgressCtrl´s color Pin
Michael Pauli7-May-03 0:44
Michael Pauli7-May-03 0:44 
Then you must grab the dc's of the respective wnd's - like this:
(it's the same story in *all* wnd's derived from CWnd - like your ctrl.)

void CMyProgressCtrl::OnNcPaint()
{
// Paint NC-part of window.
CProgressCtrl::OnNcPaint();
// Borrow the dc of the window.
CDC *pdc = GetWindowDC();
if(!pcd)
return;
// Do some stuff ... see below...

// And then release it.
::ReleaseDC(GetSafeHwnd(), (HDC)*pdc);
}

and of more interest to your problem:

void CMyProgressCtrl::OnPaint()
{
// Paint C-part of window.
CProgressCtrl::OnPaint();

CPaintDC dc_paint(this); // Always do this even if you don't want to use it - something interesting goes on in its destructor or something(?).

CDC *pdc = GetDC();
if(!pdc)
return;
CRect irClient;
GetClientRect(irClient);
// Do something...
pdc->Rectangle(0, 0, irClient.Width(), irClient.Height());
}

Good luck!

Regards M.M.
GeneralThanks you ;o) Pin
VietDelphi8-May-03 3:23
VietDelphi8-May-03 3:23 
GeneralRe: Change CProgressCtrl´s color Pin
valikac6-May-03 8:55
valikac6-May-03 8:55 
GeneralRe: Change CProgressCtrl´s color Pin
VietDelphi6-May-03 10:00
VietDelphi6-May-03 10:00 
GeneralWeek numbers! Pin
Michael Pauli6-May-03 6:20
Michael Pauli6-May-03 6:20 
GeneralRe: Week numbers! Pin
Michael Pauli6-May-03 6:27
Michael Pauli6-May-03 6:27 
Questionhow to display a jpg file on screen Pin
katak6-May-03 6:13
katak6-May-03 6:13 
AnswerRe: how to display a jpg file on screen Pin
jmkhael6-May-03 6:45
jmkhael6-May-03 6:45 
AnswerRe: how to display a jpg file on screen Pin
Joe Woodbury6-May-03 7:38
professionalJoe Woodbury6-May-03 7:38 
AnswerRe: how to display a jpg file on screen Pin
RaajaOfSelf7-May-03 2:45
RaajaOfSelf7-May-03 2:45 
GeneralWindows API comunicate with console C program Pin
franklyflee6-May-03 6:01
franklyflee6-May-03 6:01 
GeneralRe: Windows API comunicate with console C program Pin
David Crow6-May-03 6:12
David Crow6-May-03 6:12 
GeneralRe: Windows API comunicate with console C program Pin
franklyflee6-May-03 6:52
franklyflee6-May-03 6:52 
GeneralRe: Windows API comunicate with console C program Pin
David Crow6-May-03 6:57
David Crow6-May-03 6:57 
GeneralRe: Windows API comunicate with console C program Pin
franklyflee6-May-03 7:18
franklyflee6-May-03 7:18 
GeneralRe: Windows API comunicate with console C program Pin
franklyflee6-May-03 15:12
franklyflee6-May-03 15:12 
GeneralRe: Windows API comunicate with console C program Pin
franklyflee6-May-03 16:14
franklyflee6-May-03 16:14 
Generalunicode Pin
alex.barylski6-May-03 5:42
alex.barylski6-May-03 5:42 

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.