As shown in figure, the establishment of such a dialog application, after enter the upper left and lower right corner two rectangular range, and then determined by radio buttons and button in the scope of rectangle to draw graphics, sine is two cycles of sine wave, straight line is a straight line between two angular point, rectangular are two corner rectangle is determined, specific need what functions, hope that they can take time to help me have a look at the great god, thank you very much,
CodePudding user response:
Void CMFCApplication1Dlg: : OnPaint (){
CPaintDC dc (this);//for drawing device context
Dc. MoveTo (10, 20);
Dc. LineTo (100, 20);
Dc. MoveTo (10, 30);
Dc. LineTo (100, 30);
Dc. LineTo (100, 100);
Dc. The LineTo (10, 100);
Dc. LineTo (10, 30);
CPen pen_Zuobixi pen_sinx;
Pen_Zuobixi. CreatePen (PS_SOLID, 4, RGB (0, 0, 0));
Pen_sinx. CreatePen (PS_SOLID, 2, RGB (0, 0, 0));
Dc. SelectObject (& amp; Pen_Zuobixi);
//specify the origin
Dc. SetViewportOrg (50, 250);
Double y, radian;
Dc. SelectObject (& amp; Pen_sinx);
For (int x=- 30; x<660; X++)
{
//radians=X coordinate/Angle coefficient curve width * * PI
//* Y=amplitude curve width * sin (arc)
Radian=x/((double) 60 * 2) * PI;
Y=sin (radian) * 2 * 60;
Dc. MoveTo ((int), x, y) (int).
Dc. LineTo ((int), x, y) (int).
}
Pen_sinx. DeleteObject ();
Pen_Zuobixi. DeleteObject ();
}
CodePudding user response:
Bosses, the rectangular coordinates is given? Then if I want to use edit box on the left side of the input of rectangular coordinates to determine the rectangle and draw to do?CodePudding user response: