sorry, i forgot the subject.. i am a lil bit tired and busy..

hello, i got a problem,

i want to draw the graph of mathematical functions like sin or cos or

parabel's ( f(x) = x^2 ).

i use a metafile object with class CPaintDC.

CPaintDC dc(GetDlgItem(IDC_SURFACE));

the point (0;0) is in the left up corner, thats ok....

i need it in the middle so i get the middle of the metafile object like

this:

int null_x, null_y;

CWnd *pSrf;

CRect SrfRect;

pSrf = GetDlgItem(IDC_SURFACE);

pSrf->GetClientRect (SrfRect);

null_x = SrfRect.right / 2;

null_y = SrfRect.bottom / 2;

// blah...

so,

now ill start to trying to draw the sin();

i tried it so:

int x,px,py; // px and py are the points wich i use to draw..

px = null_x + x;

py = null_y - (sin(x * (pic / 180))); // yeah, i know that i dont use

amplitude in this function, but i do in the real code!

so, now appears the problem,

sin() returns double value, thats ok, but

CDC::LineTo() requires int value!

so if i declare py as double, its not the solution!

when i give double value to CDC::LineTo() it would be converted to int.. so

its impossible to draw curve this way, becaue 0.5 as double will be 0 as

int!

so i tried to round the 0.5, but now i dont know why, i see not a sin curve,

i see a line...lol

i did my own function to round values:

its quiet easy and possible wrong.. but it works

int round(double x)

{

double b;

int c;

c = x;

b = x - c;

if ( b < 0.5 )

return c;

else

return c + 1;

so, ill hope you can understand me and i hope that i dont forget something..Quote:}

:-)

maybe one of you can help me, thank you !

(please dont tell me how bad my grammer and spelling is..thank you)

... Christian Meyer