Click here to Skip to main content
15,914,162 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi,
i want to draw field lines( like in magnetism) around many objects ( 2D draw like lines, rects, ellipses, polygones..) in VC++.
could please help me?

Thanks
Posted
Comments
Sergey Alexandrovich Kryukov 8-Sep-11 21:26pm    
What kind of help do you need? What's your problem? GDI+?
--SA
ima240109 9-Sep-11 5:53am    
Hi,
thank you for your answers,
in a MDI C++ application, i draw many objects ( lines, rect, ...), for my need some of them are designed to be obstacles and others to be goals, so there is repulsive and attractive areas. my problem is that i want to draw field lines to express this, like what is showen in the following page:

http://en.wikipedia.org/wiki/Field_line

could please help me, i don't know how to do this in VC++.

Best regards

1 solution

VB
Do the following code inside the OnPaint function:




C++
CPaintDC d(this);
// Line
d.MoveTo(20,40);
d.LineTo(80,40);
// Rect
d.Rectangle(10,20,200,10);
// Round rect
d.RoundRect(10,120,200,220,20,20);
//ellipse
d.Ellipse(10,240,200,340);

//pie
d.Pie(250,10,350,110,350,110,350,10);
//polygon
POINT pt[5] = { 250,150,250,300,300,350,400,300,320,190};

d.Polygon(pt,5);
 
Share this answer
 
Comments
ima240109 9-Sep-11 5:53am    
Hi,
thank you for your answers,
in a MDI C++ application, i draw many objects ( lines, rect, ...), for my need some of them are designed to be obstacles and others to be goals, so there is repulsive and attractive areas. my problem is that i want to draw field lines to express this, like what is showen in the following page:

http://en.wikipedia.org/wiki/Field_line

could please help me, i don't know how to do this in VC++.

Best regards

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900