.
.
.. :
f(x) = A sin (ωt) + D,
A - , ω - , D - .
:
Random:
Random rnd = new Random();
, , Next();
// 1 3
int random_talk = rnd.Next(1, 4);
System.Drawing GDI+ Windows. Graphics .
# DrawLine Graphics.
: , pictureBox , . pictureBox.
pictureBox , . , .
1. Windows Form
2. : Button1 pictureBox1. , .
3. , private void Form1_Load(object sender, System.EventArgs e)
4. - Button1, private void button1_Click(object sender, EventArgs e).
5. - pictureBox1, pictureBox1 . pictureBox1 Paint, private void pictureBox1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
6. , .
7. : pictureBox1.Paint += new System.Windows.Forms.PaintEventHandler(this.pictureBox1_Paint);
8. pictureBox1 pictureBox1_Paint.
9. .
:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
// , .
using System.Drawing;
using System.Linq;
|
|
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1: Form
{
public Form1()
{
InitializeComponent();
}
float [] x = { 100.78F, 50.12F, 200.99F }; // -
float [] y = { 100.45F, 200.77F, 300.18F }; // y-
private void Form1_Load(object sender, System.EventArgs e)
{
//
this. Height = 700;
this. Width = 900;
// pictureBox1,
this. pictureBox1.Location = new System.Drawing.Point(40, 40);
// pictureBox1
this. pictureBox1.Width = 600;
this. pictureBox1.Height = 500;
// button1
this. button1.Left = this. Width - this. button1.Width - 10;
this. button1.Top = this. Height - this. button1.Height-40;
this. button1.Text = "";
}
private void pictureBox1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
// PictureBox
Graphics g = e.Graphics;
//
g.DrawLine(Pens.Red, x[0], y[0], x[1], y[1]);
g.DrawLine(Pens.Red, x[1], y[1], x[2], y[2]);
g.DrawLine(Pens.Red, x[0], y[0], x[2], y[2]);
}
private void button1_Click(object sender, EventArgs e)
{
pictureBox1.BackColor = Color.White;
pictureBox1.Visible = true;
// Connect the Paint event of the PictureBox to the event handler method.
pictureBox1.Paint += new System.Windows.Forms.PaintEventHandler(this. pictureBox1_Paint);
}
}
}