C# 绘图--飘带
2004-08-22 20:19
197 查看
C# 绘图--飘带
//-------------------------------------
// DrawStreamer.cs by Flycrane
//-------------------------------------
using System;
using System.Drawing;
using System.Windows.Forms;
class DrawStreamer : Form
{
public static void Main()
{
Application.Run( new DrawStreamer() );
}
public DrawStreamer()
{
Text= "飘带图案-Flycrane";
BackColor= Color.AliceBlue;
ForeColor= Color.Gold;
ResizeRedraw= true;
Width= 600;
Height= 350;
}
protected override void OnPaint(PaintEventArgs e)
{
Graphics myGraphics= e.Graphics;
Pen myPen= new Pen( ForeColor,2 );
// center of the circle.
float originX=ClientSize.Width/2;
float originY=ClientSize.Height;
float x1,x2,y1;
// Draw streamer,which comprise series of horizontal line segment;
for ( double a=0;a<=Math.PI ;a+=Math.PI/380 )
{
x1 =(float) ( 280*Math.Cos( 1.6*a ) +originX );
y1 =(float) ( 479-( ( 90*Math.Sin( 8*a ) )*Math.Cos( a/2.5 )+originY ) );
x2 =(float) ( 280*Math.Cos( 1.8*a )+originX );
myGraphics.DrawLine ( myPen,x1,y1,x2,y1);
}
}
}
效果图:
参考文献:
1. Charles Petzold. Programming Microsoft Windows With C#.Microsoft Press. 2002.
2. 陆润民. C语言绘图教程.清华大学出版社. 1996年4月第一版.
相关文章推荐
- C#使用双缓冲解决绘图闪屏的问题
- C#中绘图时遇到滚动条问题
- C# 绘图--金刚石
- 简单C# DGI绘图:时钟 (透明pictureBox解决抖动问题)
- c# GDI+简单绘图
- C#中实现双缓存绘图 虚拟画布
- c# GDI+简单绘图
- C#:绘图问题
- C# GDI+ 简单绘图 (三) 实现仿QQ截图功能
- C#中的绘图
- C#实现PID控制的模拟测试和曲线绘图
- c# GDI+简单绘图(二)
- C# Graphics绘图 picBox
- c# GDI+简单绘图
- C#绘图实现元胞自动机之生命的游戏(分形之美)
- C#绘图工具之Move
- C#版 代码实现 数据拟合,可用于MsChart拟合绘图等
- C#矢量绘图心得(一)--缩放功能
- c#使用GDI+简单绘图
- c# GDI+简单绘图(一)