Quantcast

Maximum PC

It is currently Mon Oct 20, 2014 2:25 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: New to Visual C++
PostPosted: Tue Feb 08, 2005 5:55 pm 
Coppermine
Coppermine

Joined: Tue Jun 29, 2004 6:07 pm
Posts: 664
Location: If you find out let me know
I'm new to Visual C++ and I need a little help with this. What I'm trying to do is use the GDI to create a program that will display the trigonometric sine and cosine functions, it will draw the x and y axes and allow me to draw sine and cosine using as many samples as I want. This is what I have in the OnDraw for the Sin command button: all I get is a straight line.
void CProject5View::OnDraw(CDC* pDC)
{
double PI = 3.1415926535;

int SamplesValue = static_cast<int>(300 - (m_Samples * PI));
pDC->MoveTo(60, 150);
pDC->LineTo(60, 300);
pDC->LineTo(575, 300);
pDC->MoveTo(60, 300);
pDC->LineTo(60, 450);

switch (m_Chart) {

case Sin:
pDC->MoveTo (300, SamplesValue);
pDC->LineTo (60, SamplesValue);
pDC->LineTo (270, SamplesValue);
pDC->LineTo (370, SamplesValue);
pDC->LineTo (470, SamplesValue);


Top
  Profile  
 
 Post subject:
PostPosted: Tue Feb 08, 2005 7:53 pm 
Team Member Top 100
Team Member Top 100

Joined: Fri Sep 17, 2004 5:35 pm
Posts: 1176
Are you using MFC?

Use code tags BTW.


Top
  Profile  
 
 Post subject:
PostPosted: Wed Feb 09, 2005 2:49 am 
Coppermine
Coppermine

Joined: Tue Jun 29, 2004 6:07 pm
Posts: 664
Location: If you find out let me know
Yes I am using MFC, sorry about that what are the code tags?


Top
  Profile  
 
 Post subject:
PostPosted: Thu Feb 10, 2005 9:18 pm 
8086
8086

Joined: Mon Aug 02, 2004 10:59 am
Posts: 50
Post code in:

[code]
blocks like this.
[/code]

With BBCode on, it will look pretty.


Top
  Profile  
 
 Post subject:
PostPosted: Fri Feb 11, 2005 3:18 am 
Coppermine
Coppermine

Joined: Tue Jun 29, 2004 6:07 pm
Posts: 664
Location: If you find out let me know
Thanks.


Top
  Profile  
 
 Post subject:
PostPosted: Fri Feb 18, 2005 5:52 am 
Coppermine
Coppermine

Joined: Tue Jun 29, 2004 6:07 pm
Posts: 664
Location: If you find out let me know
No matter which number I enter I am getting a straight line, How do I calculate axes so when I enter another number it will start from the end of the previous line?

Code:
void CProject5View::OnDraw(CDC* pDC)
{
double PI = 3.1415926535;

int SamplesValue = static_cast<int>(300 - (m_Samples * PI));
pDC->MoveTo(60, 150);
pDC->LineTo(60, 300);
pDC->LineTo(575, 300);
pDC->MoveTo(60, 300);
pDC->LineTo(60, 450);

switch (m_Chart) {

case Sin:
pDC->MoveTo (300, SamplesValue);
pDC->LineTo (60, SamplesValue);
pDC->LineTo (270, SamplesValue);
pDC->LineTo (370, SamplesValue);
pDC->LineTo (470, SamplesValue);


Top
  Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

© 2014 Future US, Inc. All rights reserved.