C#模拟求圆周率

王朝c#·作者佚名  2006-11-24
窄屏简体版  字體: |||超大  

这是最近课程设计做的一个小东西,贴出来,算法很是简单,但画图的一些方法还是值得看看的。

代码:

using System;

using System.Drawing;

using System.Collections;

using System.ComponentModel;

using System.Windows.Forms;

using System.Data;

namespace PINum

{

/// <summary>

/// Form1 的摘要说明。

/// </summary>

public class Form1 : System.Windows.Forms.Form

{

private System.Windows.Forms.Label label2;

private System.Windows.Forms.TextBox textBox2;

private System.Windows.Forms.PictureBox pictureBox1;

private System.Windows.Forms.Button button1;

private System.Windows.Forms.TextBox textBox1;

private System.Windows.Forms.Label label1;

/// <summary>

/// 必需的设计器变量。

/// </summary>

private System.ComponentModel.Container components = null;

Graphics g;

int xMin;

int yMax;

public Form1()

{

//

// Windows 窗体设计器支持所必需的

//

InitializeComponent();

//

// TODO: 在 InitializeComponent 调用后添加任何构造函数代码

//

}

/// <summary>

/// 清理所有正在使用的资源。

/// </summary>

protected override void Dispose( bool disposing )

{

if( disposing )

{

if (components != null)

{

components.Dispose();

}

}

base.Dispose( disposing );

}

#region Windows 窗体设计器生成的代码

/// <summary>

/// 设计器支持所需的方法 - 不要使用代码编辑器修改

/// 此方法的内容。

/// </summary>

private void InitializeComponent()

{

this.label2 = new System.Windows.Forms.Label();

this.textBox2 = new System.Windows.Forms.TextBox();

this.pictureBox1 = new System.Windows.Forms.PictureBox();

this.button1 = new System.Windows.Forms.Button();

this.textBox1 = new System.Windows.Forms.TextBox();

this.label1 = new System.Windows.Forms.Label();

this.SuspendLayout();

//

// label2

//

this.label2.Location = new System.Drawing.Point(232, 32);

this.label2.Name = "label2";

this.label2.Size = new System.Drawing.Size(48, 23);

this.label2.TabIndex = 11;

this.label2.Text = "圆周率";

//

// textBox2

//

this.textBox2.Location = new System.Drawing.Point(280, 32);

this.textBox2.Name = "textBox2";

this.textBox2.ReadOnly = true;

this.textBox2.Size = new System.Drawing.Size(128, 21);

this.textBox2.TabIndex = 10;

this.textBox2.Text = "";

//

// pictureBox1

//

this.pictureBox1.BackColor = System.Drawing.SystemColors.ActiveCaptionText;

this.pictureBox1.Location = new System.Drawing.Point(48, 64);

this.pictureBox1.Name = "pictureBox1";

this.pictureBox1.Size = new System.Drawing.Size(360, 200);

this.pictureBox1.TabIndex = 9;

this.pic

[1] [2] [3] 下一页

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航