Hi,
I have this bit of code to draw, for testing purposes, a line in a picture control (ID = IDC_GRAPH_D_GRAPH) located in a dialog box:
void CGraphDlg::ShowGraph(void)
{
m_iCount++;
CPaintDC dc (GetDlgItem(IDC_GRAPH_D_GRAPH));
CSize cs = dc.GetWindoxExt();
CPen lpen(PS_SOLID, 1, RGB(255, 0, 0));
dc.SelectObject(&lpen);
dc.LineTo(100,m_iCount);
}
It works OK because it does draw the line as expected in the picture control so the declaration of dc and the link from it to the picture control in question clearly works.
Oddly enough though the member function "GetWindowExt" of "CClientDC dc" always returns a CSize with values cx = 1 and cy = 1 while the actual picture control size is several hundred pixels each way.
I am not using cx and cy for now but I would like to.
Obviously I must be missing something, anybody have an idea what it might be?
I am using: Visual studio 2010, and its a very basic MFC dialog box application.
Any help much appreciated.