主要用到了GDI+中直线的绘制方法
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace yuxuan
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
}

private void Form1_Paint(object sender, PaintEventArgs pe)
{
//余玄曲线

int minX = 0, maxX = 360;
const float PI = 3.14F;
int endX = 0;
float endY = 0;

Graphics g = pe.Graphics;
Pen pen = new Pen(Color.Blue);
for (int i = minX; i <= maxX; i += 1)
{
endX = i + 1;
endY = 80*(float)Math.Cos(endX * PI / 180)+80;
g.DrawLine(pen, i, 80*(float)Math.Cos(i * PI / 180)+80, endX, endY);
}

//正玄曲线

for (int i = minX; i <= maxX; i += 1)
{
endX = i + 1;
endY = 80 * (float)Math.Sin(endX * PI / 180) + 80+200;
g.DrawLine(pen, i, 80 * (float)Math.Sin(i * PI / 180) + 80+200, endX, endY);

}


//g.DrawLine(pen, 10, 100, 200, 100);
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace yuxuan
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void Form1_Paint(object sender, PaintEventArgs pe)
{
//余玄曲线
int minX = 0, maxX = 360;
const float PI = 3.14F;
int endX = 0;
float endY = 0;
Graphics g = pe.Graphics;
Pen pen = new Pen(Color.Blue);
for (int i = minX; i <= maxX; i += 1)
{
endX = i + 1;
endY = 80*(float)Math.Cos(endX * PI / 180)+80;
g.DrawLine(pen, i, 80*(float)Math.Cos(i * PI / 180)+80, endX, endY);
}
//正玄曲线
for (int i = minX; i <= maxX; i += 1)
{
endX = i + 1;
endY = 80 * (float)Math.Sin(endX * PI / 180) + 80+200;
g.DrawLine(pen, i, 80 * (float)Math.Sin(i * PI / 180) + 80+200, endX, endY);
}

//g.DrawLine(pen, 10, 100, 200, 100);
}
}
}



浙公网安备 33010602011771号