ÔÆÌ⺣ - רҵÎÄÕ·¶ÀýÎĵµ×ÊÁÏ·ÖÏíÆ½Ì¨

µ±Ç°Î»ÖãºÊ×Ò³ > Êý¿ØÏµÍ³ÖÐCÑùÌõÇúÏ߲岹·½·¨µÄÉè¼ÆÓëʵÏÖ - ÂÛÎÄ0506-new

Êý¿ØÏµÍ³ÖÐCÑùÌõÇúÏ߲岹·½·¨µÄÉè¼ÆÓëʵÏÖ - ÂÛÎÄ0506-new

  • 62 ´ÎÔĶÁ
  • 3 ´ÎÏÂÔØ
  • 2025/5/22 22:20:44

ÉòÑôʦ·¶´óѧ±¾¿Æ±ÏÒµÂÛÎÄ

¸½Â¼Ò»£º ³ÌÐò´úÂë

using System;

using System.Colleectionss.Geeneriic; using System.ComponenttMoodel; using System.Dattaa; using System.Draawwing; using System.Linbq; using System.Texxt;

using System.Windowss.Formss; using System.Drawingg.Drrawingg2D; using System.Drawing.Imaging;

namespace Demo {

public partialal class Form11 : Form1 {

Graphics graphics; Pen greenPen;

Label[] labelN = new Label[20]; Label[] labelX = new Label[20]; Label[] labelY = new Label[20]; TextBox[] TextX = new TextBox[20]; TextBox[] TextY = new TextBox[20];

int PtNum = 10; public Form1() {

InitializeComponent(); }

private void Form11_Load(object sender, EvArgs ee) {

graphics = pictureBox1.CreateGraphics(); greenPen = new Pen(Color.Blue); InitZuoBiao(); button1.Enabled = false; button2.Enabled =false ; }

private void button1_Click(object sender, EventArgs e) {

graphicss.Clearr(pictureBoxx1.BackColor );

InitZuoBiao(); FillPts();

-29-

ÉòÑôʦ·¶´óѧ±¾¿Æ±ÏÒµÂÛÎÄ

DrawLins(); }

private void InitPtNum() {

int iLoop;

for (iLoop = 0; iLoop < PtNum; iLoop++) {

labelN[iLoop] = new Label(); labelX[iLoop] = new Label(); labelY[iLoop] = new Label(); TextX[iLoop] = new TextBox(); TextY[iLoop] = new TextBox();

this.Controls.Add(labelN[iLoop]); this.Controls.Add(labelX[iLoop]); this.Controls.Add(labelY[iLoop]); this.Controls.Add(TextX[iLoop]); this.Controls.Add(TextY[iLoop]); //l.ForeColor = Color.White;

//labelN[iLoop].Cursor = System.Windows.Forms.Cursors.Hand;

labelN[iLoop].Location = new System.Drawing.Point(640, 50 + iLoop * 40); labelN[iLoop].Name = \; labelN[iLoop].Size = new System.Drawing.Size(30, 12); labelN[iLoop].TabIndex = 5;

labelN[iLoop].Text = \µã¨¬?\ + (iLoop + 1).ToString();

labelX[iLoop].Location = new System.Drawing.Point(670, 50 + iLoop * 40); labelX[iLoop].Name = \;

labelX[iLoop].Size = new System.Drawing.Size(14, 12); labelX[iLoop].TabIndex = 5; labelX[iLoop].Text = \;

labelY[iLoop].Location = new System.Drawing.Point(760, 50 + iLoop * 40); labelY[iLoop].Name = \; labelY[iLoop].Size = new System.Drawing.Size(14, 12); labelY[iLoop].TabIndex = 5; labelY[iLoop].Text = \;

TextX[iLoop].Location = new System.Drawing.Point(690, 45 + iLoop * 40); TextX[iLoop].Name = \; TextX[iLoop].Size = new System.Drawing.Size(62, 21); TextX[iLoop].TabIndex = 5; TextX[iLoop].Text = (iLoop * 30).ToString(); ;

TextY[iLoop].Location = new System.Drawing.Point(780, 45 + iLoop * 40); TextY[iLoop].Name = \; TextY[iLoop].Size = new System.Drawing.Size(62, 21);

-30-

ÉòÑôʦ·¶´óѧ±¾¿Æ±ÏÒµÂÛÎÄ

TextY[iLoop].TabIndex = 5; TextY[iLoop].Text = (iLoop * 50).ToString(); ; } }

private void InitZuoBiao() {

greenPen.Color = Color.Black; greenPen.Width = 1;

greenPen.DashStyle = DashStyle.Dash;

graphics.DrawLine(greenPen, new PointF(150, 10), new PointF(150, 520)); graphics.DrawLine(greenPen, new PointF(250, 10), new PointF(250, 520)); graphics.DrawLine(greenPen, new PointF(300, 0), new PointF(300, 500)); graphics.DrawLine(greenPen, new PointF(400, 0), new PointF(400, 500)); graphics.DrawLine(greenPen, new PointF(500, 0), new PointF(500, 500));

graphics.DrawLine(greenPen, new PointF(150, 10), new PointF(150, 520)); graphics.DrawLine(greenPen, new PointF(250, 10), new PointF(250, 520)); graphics.DrawLine(greenPen, new PointF(0, 300), new PointF(600, 300)); graphics.DrawLine(greenPen, new PointF(0, 400), new PointF(600, 400));

greenPen.Width = 3;

greenPen.DashStyle = DashStyle.Solid;

graphics.DrawLine(greenPen, new PointF(1, 0), new PointF(1, 500));

graphics.DrawLine(greenPen, new PointF(0, 530 - 5), new PointF(600, 530 - 5)); }

private void FillPts() {

greenPen.Color = Color.Blue;

Brush brush = new SolidBrush(Color.Green); int raidus = 10;

PointF[] curvePoints = new PointF[PtNum]; int iLoop;

for (iLoop = 0; iLoop < PtNum; iLoop++) {

curvePoints[iLoop] = new PointF(Convert.ToSingle(TextX[iLoop].Text), 500 - Convert.ToSingle(TextY[iLoop].Text));

graphics.FillEllipse(brush, curvePoints[iLoop].X - raidus / 2, curvePoints[iLoop].Y - raidus / 2, raidus, raidus);

} }

private void DrawLins() {

PointF[] curvePoints = new PointF[PtNum]; int iLoop;

for (iLoop = 0; iLoop < PtNum; iLoop++)

-31-

ÉòÑôʦ·¶´óѧ±¾¿Æ±ÏÒµÂÛÎÄ

{

curvePoints[iLoop] = new PointF(Convert.ToSingle(TextX[iLoop].Text), 500 - Convert.ToSingle(TextY[iLoop].Text)); }

greenPen.Color = Color.Blue;

graphics.DrawLines(greenPen, curvePoints); }

private void DrawCurv() {

PointF[] curvePoints = new PointF[PtNum]; int iLoop;

for (iLoop = 0; iLoop < PtNum; iLoop++) {

curvePoints[iLoop] = new PointF(Convert.ToSingle(TextX[iLoop].Text), 500 - Convert.ToSingle(TextY[iLoop].Text)); }

greenPen.Color = Color.Red;

graphics.DrawCurve(greenPeen, curvePoinsts, 0.6F); }

private void button2_Click(object sender, EventArgs e) {

CubeCacluate(); }

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) {

int iLoop;

for (iLoop = 0; iLoop < PtNum; iLoop++) {

if(labelN[iLoop]!=null) labelN[iLoop].Dispose(); if (labelX[iLoop] != null) labelX[iLoop].Dispose(); if (labelY[iLoop] != null) labelY[iLoop].Dispose(); if (TextX[iLoop] != null) TextX[iLoop].Dispose(); if (TextY[iLoop] != null) TextY[iLoop].Dispose(); }

button1.Enabled = true; button2.Enabled = true;

PtNum = comboBox1.SelectedIndex+2; InitPtNum(); }

-32-

  • ÊÕ²Ø
  • Î¥¹æ¾Ù±¨
  • °æÈ¨ÈÏÁì
ÏÂÔØÎĵµ10.00 Ôª ¼ÓÈëVIPÃâ·ÑÏÂÔØ
ÍÆ¼öÏÂÔØ
±¾ÎÄ×÷Õߣº...

¹²·ÖÏí92ƪÏà¹ØÎĵµ

Îĵµ¼ò½é£º

ÉòÑôʦ·¶´óѧ±¾¿Æ±ÏÒµÂÛÎÄ ¸½Â¼Ò»£º ³ÌÐò´úÂë using System; using System.Colleectionss.Geeneriic; using System.ComponenttMoodel; using System.Dattaa; using System.Draawwing; using System.Linbq; using System.Texxt; using System.Windowss.Formss; using System.Drawingg.Drrawingg2D; using System.Drawing.Imaging; namespace Demo { public partialal class Form11 : Form1

¡Á ÓοͿì½ÝÏÂÔØÍ¨µÀ£¨ÏÂÔØºó¿ÉÒÔ×ÔÓɸ´ÖƺÍÅŰ棩
µ¥Æª¸¶·ÑÏÂÔØ
ÏÞÊ±ÌØ¼Û£º10 Ôª/·Ý Ô­¼Û:20Ôª
VIP°üÔÂÏÂÔØ
ÌØ¼Û£º29 Ôª/Ô ԭ¼Û:99Ôª
µÍÖÁ 0.3 Ôª/·Ý ÿÔÂÏÂÔØ150·Ý
ȫվÄÚÈÝÃâ·Ñ×ÔÓɸ´ÖÆ
VIP°üÔÂÏÂÔØ
ÌØ¼Û£º29 Ôª/Ô ԭ¼Û:99Ôª
µÍÖÁ 0.3 Ôª/·Ý ÿÔÂÏÂÔØ150·Ý
ȫվÄÚÈÝÃâ·Ñ×ÔÓɸ´ÖÆ
×¢£ºÏÂÔØÎĵµÓпÉÄÜ¡°Ö»ÓÐĿ¼»òÕßÄÚÈݲ»È«¡±µÈÇé¿ö£¬ÇëÏÂÔØÖ®Ç°×¢Òâ±æ±ð£¬Èç¹ûÄúÒѸ¶·ÑÇÒÎÞ·¨ÏÂÔØ»òÄÚÈÝÓÐÎÊÌ⣬ÇëÁªÏµÎÒÃÇЭÖúÄã´¦Àí¡£
΢ÐÅ£ºfanwen365 QQ£º370150219
Copyright © ÔÆÌ⺣ All Rights Reserved. ËÕICP±¸16052595ºÅ-3 ÍøÕ¾µØÍ¼ ¿Í·þQQ£º370150219 ÓÊÏ䣺370150219@qq.com