Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all articles
Browse latest Browse all 3029

[RESOLVED] Programming Logic: Drawing (radius sized) lines from centre to boundary of circle

$
0
0
Hi,
I am facing a programming logic problem. I want to draw radius sized lines from centre of circle to the circle boundary.
My code is:

Code:

int x1, y1, x2, y2, i, r, old_xc,old_yc, x,y;
int xc, yc;
x1=170;
y1=300;
x2=70;
y2=400;
pDC->Ellipse(x1,y1,x2,y2);
r= (y2-y1)/2;
old_xc=xc=x2+r;
old_yc=yc=y1+r;
CPen newPen;
CPen* pOldPen=NULL;
int color3,color2,color1;
color3=color2=color1=255;
y=y1;
x=xc;
for(i=0; i<50; ++i) {
        pDC->MoveTo(old_xc, old_yc);
        pDC->LineTo(xc,y1);

    xc--;
        y1++;}

The lines are touching the circle boudary at only start while the rest of lines are smaller and the shape is a triangle instead of a pie slice. Somebody plz guide me.

Zulfi.

Viewing all articles
Browse latest Browse all 3029

Latest Images

Trending Articles



Latest Images