Click here to Skip to main content
15,891,785 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: MFC background color Pin
lor754-Feb-15 20:51
lor754-Feb-15 20:51 
GeneralRe: MFC background color Pin
Richard MacCutchan4-Feb-15 21:29
mveRichard MacCutchan4-Feb-15 21:29 
QuestionExtending named server overlapped IO Pin
venkat swaminathan3-Feb-15 8:54
venkat swaminathan3-Feb-15 8:54 
AnswerRe: Extending named server overlapped IO Pin
Frankie-C8-Feb-15 3:35
Frankie-C8-Feb-15 3:35 
GeneralRe: Extending named server overlapped IO Pin
venkat swaminathan8-Feb-15 17:23
venkat swaminathan8-Feb-15 17:23 
QuestionHow I can read and write dicom image via c++? Pin
ahmed088sm3-Feb-15 8:05
ahmed088sm3-Feb-15 8:05 
AnswerRe: How I can read and write dicom image via c++? Pin
jeron13-Feb-15 8:34
jeron13-Feb-15 8:34 
QuestionKeeping track of fonts, pens, device contexts, etc. Pin
Anthony Appleyard3-Feb-15 2:32
Anthony Appleyard3-Feb-15 2:32 
I wrote a program which includes these declarations:-

C++
class PEN{public: HDC d; HPEN pen,old;
    PEN(HDC dc,COLORREF col);
    ~PEN();};

/*-----*/
/* the device context dc must still exist when the pen is deleted */
C++
PEN::PEN(HDC dc,COLORREF col){ // constructor
    d=dc;
    pen=(HPEN)CreatePen(0,1,col);
    old=(HPEN)SelectObject(dc,pen);};
PEN::~PEN(){ // destructor
    SelectObject(d,old);
    DeleteObject(pen);};

/*-----*/
// then I can write for example:-
/*-----*/
C++
if(xhairs) {
    PEN orange(WIdc,RGB(255,128,0)); // crosshairs
    Line(WIdc,0,b/2,(int)(2*a),(int)(b/2));
    Line(WIdc,(int)(a/2),0,(int)(a/2),b);
    Line(WIdc,(int)(a*1.5),0,(int)(a*1.5),b);}

/*-----*/
and the new pen is automatically cleared away when control leaves the block where the pen was declared.

And similarly with fonts etc.

modified 3-Feb-15 9:41am.

AnswerRe: Keeping track of fonts, pens, device contexts, etc. Pin
Richard Andrew x643-Feb-15 4:55
professionalRichard Andrew x643-Feb-15 4:55 
GeneralRe: Keeping track of fonts, pens, device contexts, etc. Pin
Anthony Appleyard3-Feb-15 5:12
Anthony Appleyard3-Feb-15 5:12 
GeneralRe: Keeping track of fonts, pens, device contexts, etc. Pin
Richard MacCutchan3-Feb-15 6:59
mveRichard MacCutchan3-Feb-15 6:59 
QuestionHow to create floating toolbar that always active in MFC application Pin
Member 111256243-Feb-15 1:38
Member 111256243-Feb-15 1:38 
QuestionA query about Visual C/C++ 2008 edition's main menu Pin
Anthony Appleyard2-Feb-15 22:09
Anthony Appleyard2-Feb-15 22:09 
AnswerRe: A query about Visual C/C++ 2008 edition's main menu Pin
Richard MacCutchan2-Feb-15 23:18
mveRichard MacCutchan2-Feb-15 23:18 
QuestionHow can I created window console application that read these: Pin
Member 1141745231-Jan-15 12:18
Member 1141745231-Jan-15 12:18 
AnswerRe: How can I created window console application that read these: Pin
Garth J Lancaster31-Jan-15 13:47
professionalGarth J Lancaster31-Jan-15 13:47 
AnswerRe: How can I created window console application that read these: Pin
Richard MacCutchan1-Feb-15 0:47
mveRichard MacCutchan1-Feb-15 0:47 
QuestionError while compiling Pin
Member 1094400430-Jan-15 19:49
Member 1094400430-Jan-15 19:49 
AnswerRe: Error while compiling Pin
pasztorpisti30-Jan-15 23:20
pasztorpisti30-Jan-15 23:20 
GeneralRe: Error while compiling Pin
Member 109440042-Feb-15 20:05
Member 109440042-Feb-15 20:05 
GeneralRe: Error while compiling Pin
pasztorpisti3-Feb-15 12:25
pasztorpisti3-Feb-15 12:25 
GeneralRe: Error while compiling Pin
Member 109440045-Feb-15 0:23
Member 109440045-Feb-15 0:23 
AnswerRe: Error while compiling Pin
Mike Nordell2-Feb-15 10:44
Mike Nordell2-Feb-15 10:44 
GeneralRe: Error while compiling Pin
Member 109440042-Feb-15 17:30
Member 109440042-Feb-15 17:30 
GeneralRe: Error while compiling Pin
Mike Nordell7-Feb-15 14:55
Mike Nordell7-Feb-15 14:55 

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.