




















主要用到了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);
}
}
}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。