⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 class2.cs

📁 这是《C#图形程序设计》这本书的源代码
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;


namespace 递归图形
{
	/// <summary>
	/// Class2 的摘要说明。
	/// </summary>
	public class Class2
	{
		public Class2()
		{
			//
			// TODO: 在此处添加构造函数逻辑
			//
		}
		public void circles(Graphics g1,Pen pen1,double x,double y,double r,int n)
		{
			double[] ccos=new double[100];
			double[] csin=new double[100];
			int i;
			float theta;
			float f=0.3f;
			float c=2f;
			theta=2*3.14f/8f;
			double n1,fr;
			n1=n-1;
			fr=f*r;
			if(n1>1)
			{
				for(i=1;i<=8;i++)
				{
					ccos[i]=c*Math.Cos(i*theta);
					csin[i]=c*Math.Sin(i*theta);
					g1.DrawEllipse(pen1,(float)(x+r*ccos[i]-fr),(float)(y+r*csin[i]-fr),(float)(2*fr),(float)(2*fr));
					this.circles(g1,pen1,x+r*ccos[i],y+r*csin[i],fr,(int)(n1));
				}
			}
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -