I've never come across this type of source code before? What is it called and are there tutorials explaining what the functions mean?
Code:CB3::~CB3() { } void CB3::Draw(CDC *pDC) { /*******************************/ // Place your drawing code here. // Examples are given below. /*******************************/ // Select a solid black (black = RGB(0,0,0)) pen with a width of 1 pixel. int penWidth = 1; CPen pen(PS_SOLID,penWidth,RGB(0,0,0)); // Store the previous pen and set the current pen for drawing on the screen. CPen *ppen=pDC->SelectObject(&pen); // Select a solid blue (blue = RGB(0,0,255)) brush to fill an enclosed area. CBrush brush(RGB(0,0,255)); // You can select other fill patterns, such as HS_BDIAGONAL, // HS_CROSS, HS_DIAGCROSS, HS_FDIAGONAL, HS_HORIZONTAL, HS_VERTICAL. // The following line selects a HS_CROSS brush // CBrush brush(HS_CROSS, RGB(0,0,255)); // Store the previous brush and set the current brush for painting. CBrush *pbrush=pDC->SelectObject(&brush); // Draw a rectangle pDC->Rectangle(70,20,120,120); // Draw a round rectangle pDC->RoundRect(150,20,200,120,10,15); // Draw an ellipse pDC->Ellipse(220,20, 280,120); // Draw a polygon with 5 vertices. CPoint *vertices = new CPoint[5]; vertices[0].x = 300; vertices[0].y = 50; vertices[1].x = 330; vertices[1].y = 20; vertices[2].x = 370; vertices[2].y = 40; vertices[3].x = 440; vertices[3].y = 30; vertices[4].x = 380; vertices[4].y = 120; pDC->Polygon(vertices,5); delete vertices; // Recover the previous pen and delete the current pen. pDC->SelectObject(ppen); pen.DeleteObject(); // Recover the previous brush and delete the current brush. pDC->SelectObject(pbrush); brush.DeleteObject(); }



LinkBack URL
About LinkBacks


