Thread: is this code mfc or api or openGL etc.?

  1. #1
    Registered User
    Join Date
    Jan 2011
    Posts
    144

    is this code mfc or api or openGL etc.?

    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();
    }

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    It's c++ GDI class.

    Look up the functions on MSDN ... Google is your friend.

  3. #3
    'Allo, 'Allo, Allo
    Join Date
    Apr 2008
    Posts
    639
    It's (broken) MFC, the M stands for Microsoft, so do as the man says and search MSDN

  4. #4
    Registered User
    Join Date
    Dec 2007
    Posts
    214
    Why do you say its broken?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can I have some Sample Code? (OpenGL, glDrawPixels();)
    By Shamino in forum Game Programming
    Replies: 98
    Last Post: 11-03-2005, 10:46 AM
  2. Thread Synchronization :: Win32 API vs. MFC
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 08-09-2002, 09:09 AM
  3. MFC Assertion Failure
    By maxthecat in forum Windows Programming
    Replies: 5
    Last Post: 08-01-2002, 09:58 AM
  4. MFc & API
    By knight543 in forum C++ Programming
    Replies: 2
    Last Post: 02-01-2002, 11:52 AM
  5. MFC or Windows API
    By aresashura in forum Windows Programming
    Replies: 7
    Last Post: 12-01-2001, 10:21 PM