void CFileDlg::OnPaint() { CPaintDC dc(this); // device context for painting // TODO: 在此处添加消息处理程序代码 // 不为绘图消息调用 CDialog::OnPaint() CRect rect; GetClientRect(rect); // dc.FillSolidRect(rect,RGB(255,255,255)); CClientDC aDC(this); //CClientDC的构造函数需要一个参数,这个参数是指向绘图窗口的指针,我们用this指针就可以了 CPoint startPoint; CPoint endPoint; startPoint.x = -1; startPoint.y = 38; endPoint.x = rect.Width()+1; endPoint.y = 38; COLORREF m_Color(RGB(160,160,255)); CPen pen(PS_SOLID,1,m_Color); ////建立一个画笔类对象,构造时设置画笔属性 aDC.SelectObject(&pen); aDC.MoveTo(startPoint); aDC.LineTo(endPoint); startPoint.x = -1; startPoint.y = 40; endPoint.x = rect.Width()+1; endPoint.y = 40; COLORREF m_Color3(RGB(255,255,255)); CPen pen3(PS_SOLID,2,m_Color3); ////建立一个画笔类对象,构造时设置画笔属性 aDC.SelectObject(&pen3); aDC.MoveTo(startPoint); aDC.LineTo(endPoint); startPoint.x = 218; startPoint.y = 38; endPoint.x = 218; endPoint.y = rect.Height()+2; COLORREF m_Color2(RGB(190,190,190)); CPen pen2(PS_SOLID,1,m_Color2); aDC.SelectObject(&pen2); aDC.MoveTo(startPoint); aDC.LineTo(endPoint); }
void VSkyPart::SendGeometry(graphics::IVDevice& in_Device) const { if(m_ShowAsLine) { glPolygonMode(GL_BACK,GL_LINE); glPolygonMode(GL_FRONT,GL_LINE); } glDisable( GL_CULL_FACE ); graphics::VColor4f m_Color(1,1,1,1); glColor4f(m_Color.red, m_Color.green, m_Color.blue, m_Color.alpha); in_Device.RenderMesh(&*m_hMesh); glPopAttrib(); glPopMatrix(); if(m_ShowAsLine) { glPolygonMode(GL_BACK,GL_FILL); glPolygonMode(GL_FRONT,GL_FILL); } }