Thread View: comp.lang.c++.leda
1 messages
1 total messages
Started by Joel Castellanos
Fri, 13 Oct 1995 14:21
Visual C++ question
Author: Joel Castellanos
Date: Fri, 13 Oct 1995 14:21
Date: Fri, 13 Oct 1995 14:21
32 lines
1168 bytes
1168 bytes
This question is about using the MFC.
CMainWnd::CMainWnd(){
Create(NULL, "XX", WS_OVERLAPPEDWENDOW, DefauldRect,NULL,NULL);
}
void CMainWnd::OnPaint() {
CPaintDC dc(this);
dc.Rectangle(100,100,180,140);
}
The above program works just fine - then when I
try to move the "Rectangle" statement to a function I cannot
get the function to recognize "CPaintDC" ie.:
CMainWnd::CMainWnd(){
Create(NULL, "XX", WS_OVERLAPPEDWENDOW, DefauldRect,NULL,NULL);
}
void myRect(int x) {
dc.Rectangle(x,x,x+80,x+40);
return(0);
}
void CMainWnd::OnPaint() {
CPaintDC dc(this);
myRect(100);
}
First I tryed declaring CPaintDC dc(this) outside of both functions
(making it global), but the compiler complains about this.
If you know how to do this, then please send me some advice.
Thanks
Joel (joel@es.rice.edu)
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads