Drawing on a static control.
-
Hi, How do I use a static control to draw on a dialog ? So far, I have created a static text control and added a member control variable to it of type CStatic. Now, I am required to subclass the text control so that i can override its OnPaint() function but i do not know how to achieve that. Any help will be highly appreciated. llp00na
-
Hi, How do I use a static control to draw on a dialog ? So far, I have created a static text control and added a member control variable to it of type CStatic. Now, I am required to subclass the text control so that i can override its OnPaint() function but i do not know how to achieve that. Any help will be highly appreciated. llp00na
Maybe this article[^] will help. It is about subclassing a CButton but the procedure is the same (AFAIK) for a static control.
Cédric Moonen Software developer
Charting control -
Hi, How do I use a static control to draw on a dialog ? So far, I have created a static text control and added a member control variable to it of type CStatic. Now, I am required to subclass the text control so that i can override its OnPaint() function but i do not know how to achieve that. Any help will be highly appreciated. llp00na
Hi, Declare the member variable for that static control. ex: if the subclass for static is cmystatic initialize the variable in dlg cDlg.h #include "mystatic.h" CMystatic stat; //Cdlg.cpp void CDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CFirstDlg) DDX_Control(pDX, IDC_STATIC_FIRST, m_fir); //}}AFX_DATA_MAP }
-
Hi, How do I use a static control to draw on a dialog ? So far, I have created a static text control and added a member control variable to it of type CStatic. Now, I am required to subclass the text control so that i can override its OnPaint() function but i do not know how to achieve that. Any help will be highly appreciated. llp00na
llp00na wrote:
Now, I am required to subclass the text control so that i can override its OnPaint() function but i do not know how to achieve that.
Use ClassWizard (Ctrl+W) to derive a new class from
CStatic
. Then you can override itsOnPaint()
method.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
-
llp00na wrote:
Now, I am required to subclass the text control so that i can override its OnPaint() function but i do not know how to achieve that.
Use ClassWizard (Ctrl+W) to derive a new class from
CStatic
. Then you can override itsOnPaint()
method.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
-
Maybe this article[^] will help. It is about subclassing a CButton but the procedure is the same (AFAIK) for a static control.
Cédric Moonen Software developer
Charting control -
Hi, Declare the member variable for that static control. ex: if the subclass for static is cmystatic initialize the variable in dlg cDlg.h #include "mystatic.h" CMystatic stat; //Cdlg.cpp void CDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CFirstDlg) DDX_Control(pDX, IDC_STATIC_FIRST, m_fir); //}}AFX_DATA_MAP }