View Single Post
  #1  
Old 15-02-2011, 07:51 AM
.BZU.'s Avatar
.BZU. .BZU. is offline


 
Join Date: Sep 2007
Location: near Govt College of Science Multan Pakistan
Posts: 9,693
Contact Number: Removed
Program / Discipline: BSIT
Class Roll Number: 07-15
.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute
Default Mfc (Microsoft Foundation Class ) Assignment.

Code:
#include
#include "resource.h"
class myframe: public CFrameWnd
{
public:
	myframe()
	{
		Create(0,"message Demo");
	}


	void OnPaint()
	{
		CPaintDC d(this);
		int i=5,c=4,y=10,ht;
		char str[15];
		CRect r;
		GetClientRect(&r);
	
		TEXTMETRIC tm;
		d.GetTextMetrics(&tm);
		ht=tm.tmHeight+tm.tmExternalLeading;

		for(i=1;i<=10;i++)
		{
			sprintf(str,"%d * ",i);
			d.TextOut(20,y,str,strlen(str));

			sprintf(str,"%d = ",c);
			d.TextOut(60,y,str,strlen(str));

			sprintf(str,"%d",i*c);
			d.TextOut(100,y,str,strlen(str));
			
			y=y+ht;
		}
	
	
	}
	DECLARE_MESSAGE_MAP()
};

BEGIN_MESSAGE_MAP(myframe,CFrameWnd)
	ON_WM_PAINT()
END_MESSAGE_MAP()

class myapp: public CWinApp
{
public:
	int InitInstance()
	{
		myframe *p;
		p=new myframe;
		p->ShowWindow(3);
		m_pMainWnd=p;
		return 1;
	}
};
myapp a;
Code:
#include
#include "resource.h"
int xco,yco;
class myframe: public CFrameWnd
{
public:
	myframe()
	{
		Create(0,"message Demo");
	}
		void OnLButtonDown( UINT flag, CPoint pt)
		{
			CClientDC d(this);
			xco=pt.x;
			yco=pt.y;			
		}

	
		void OnMouseMove(UINT flag, CPoint pt)
		{
			CClientDC d(this);
			if(flag== MK_LBUTTON)
			{
				d.MoveTo(xco,yco);
				d.LineTo(pt.x,pt.y);
				xco=pt.x;
				yco=pt.y;
			}
		}
	
	
	DECLARE_MESSAGE_MAP()
};

BEGIN_MESSAGE_MAP(myframe,CFrameWnd)
	ON_WM_LBUTTONDOWN()
	ON_WM_MOUSEMOVE()
END_MESSAGE_MAP()

class myapp: public CWinApp
{
public:
	int InitInstance()
	{
		myframe *p;
		p=new myframe;
		p->ShowWindow(3);
		m_pMainWnd=p;
		return 1;
	}
};
myapp a;
Code:
#include
#include "resource.h"
class myframe: public CFrameWnd
{
public:
	myframe()
	{
		Create(0,"message Demo");
	}


	void OnPaint()
	{
		CPaintDC d(this);
		int i=5,c=4,y=10,ht,x=20;
		char str[15];
		CRect r;
		GetClientRect(&r);
	
		TEXTMETRIC tm;
		d.GetTextMetrics(&tm);
		ht=tm.tmHeight+tm.tmExternalLeading;

		for(c=2;c<=10;c++)
		{
		for(i=1;i<=10;i++)
		{
			sprintf(str,"%d * ",i);
			d.TextOut(x,y,str,strlen(str));

			sprintf(str,"%d = ",c);
			d.TextOut(x+40,y,str,strlen(str));

			sprintf(str,"%d",i*c);
			d.TextOut(x+80,y,str,strlen(str));
			
			y=y+ht;
		}
		x=x+200;
		if(c<6)
			y=10;
		else
		{	
			y=300;
			if(c==6)
				x=20;
		}

		}
	
	
	}
	DECLARE_MESSAGE_MAP()
};

BEGIN_MESSAGE_MAP(myframe,CFrameWnd)
	ON_WM_PAINT()
END_MESSAGE_MAP()

class myapp: public CWinApp
{
public:
	int InitInstance()
	{
		myframe *p;
		p=new myframe;
		p->ShowWindow(3);
		m_pMainWnd=p;
		return 1;
	}
};
myapp a;

Attached Files
File Type: doc Mfc (Microsoft Foundation Class ) Assignment.doc (30.5 KB, 420 views)
__________________
(¯`v´¯)
`*.¸.*`

¸.*´¸.*´¨) ¸.*´¨)
(¸.*´ (¸.
Bzu Forum

Don't cry because it's over, smile because it happened
Reply With Quote