惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

人人都是产品经理
人人都是产品经理
aimingoo的专栏
aimingoo的专栏
Y
Y Combinator Blog
B
Blog
D
Docker
C
Check Point Blog
A
About on SuperTechFans
云风的 BLOG
云风的 BLOG
F
Fortinet All Blogs
Stack Overflow Blog
Stack Overflow Blog
Recent Announcements
Recent Announcements
MongoDB | Blog
MongoDB | Blog
WordPress大学
WordPress大学
Jina AI
Jina AI
罗磊的独立博客
月光博客
月光博客
博客园 - Franky
L
LangChain Blog
H
Help Net Security
Google DeepMind News
Google DeepMind News
Microsoft Security Blog
Microsoft Security Blog
小众软件
小众软件
T
Tailwind CSS Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

博客园 - AndrewCheng

TableAdapter和多组数据结果 即时查看程序输出的VS插件 让.Net验证控件与自定义验证合作无间 把你的应用程序添加到IE工具栏 - AndrewCheng - 博客园 拦截并分发运行时动态创建控件的事件 程序设计中的调试方法总结 从SQL Server 数据库转换为Access注意事项 昆明喷码机耗材科技有限公司 软件版本后缀所代表的含义 论坛网址 工作格言 加密 web.config - AndrewCheng - 博客园 C#正则表达式 - AndrewCheng - 博客园 论坛等级分类 - AndrewCheng - 博客园 SQL Server和Oracle的常用函数对比 屏蔽IE浏览器javasccipt的方法 VS2005断开VSS后再次连接上VSS时注意事项 asp.net2.0页面按钮点击无效的解决办法 delegate与event示例程序
C#实现的正余玄函数图象
AndrewCheng · 2007-04-24 · via 博客园 - AndrewCheng

主要用到了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);
        }

    }

}