Welcome to pickSourcecode.com Login | Register    
pickZy.com
 Home  | search  | games  | General  | C  | C++  | Java  | Php  | Networking  | Visual Basic  | VC++  | Win32  | MFC  | JavaScript  | Jobs  | JavaScript  | Post jobs
VC++ - Line Drawing, Shapes and saving, using Document / view Architecture       Share
2008-10-04 |  RatheeshTR  | Viewed: 875  |    0

/*  
The  cline  Class

Our  program  stores  the  information  about  the  lines  thar  are  drawn  in  an  array  of  cline  objects.  The  cline
class  is  publicly  derived  from  CObject.  This  makes  it  easy  for  us  to  add  serialization  support  to  the  cline  
class.  so  that  the  entire  drawing  can  be  saved  or  restored  with  just  a  few  lines  of  code.
*/


//  cline.h
class cline : public CObject

{

DECLARE_SERIAL ( cline ) 


private :


CPo
int startpt ;
CPo
int endpt ;

public :


cline( ) ;

cline ( CPo
int from, CPoint to ) ;
void Serialize ( CArchive &ar ) ;
void draw ( CDC *p ) ;
} ;


//  cline.cpp
#include <afxwin.h>
#include "cline.h"

IMPLEMENT_SERIAL ( cline, CObject, 1 ) 


cline::cline( )

{

}


cline::cline ( CPo
int from, CPoint to ) 
{

startpt = from ;

endpt = to ;

}


void cline::Serialize ( CArchive &ar )
{

CObject::Serialize ( ar ) ;


if ( ar.IsStoring( ) ) 
ar << startpt << endpt ;

else

ar >> startpt >> endpt ;

}


void cline::draw ( CDC *p )
{

p -> MoveTo ( startpt ) ;

p -> LineTo ( endpt ) ;

}


//  Output


Comments:





Submit comment's

Type:

User Comment's:

Submitted By:
Prof: Software Engineer
Tech: C ,Cpp
Send Mail: ratheesh



Related topics
vcpp - CreateProcess sample ( child process )

Related References
vcpp - a simple printing application

Web site contents © Copyright 2007, All rights reserved.
Help | Terms and Conditions | Privacy Policy | About Us