Text: |
ԲΠ= Áàòàð÷óê 2
Çàïèòàííÿ: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 WindowsFormsApplication3
{
public partial class Form1 : Form
{
int H, H_;
int W, W_;
bool F;
double rez;
public Form1()
{
InitializeComponent();
}
private void button1_MouseDown(object sender, MouseEventArgs e)
{
H = e.Y;
W = e.X;
F = true;
rez = 0;
}
private void button1_MouseUp(object sender, MouseEventArgs e)
{
F = false;
}
private void button1_MouseClick(object sender, MouseEventArgs e)
{
textBox1.Text = Convert.ToString(rez);
}
private void button1_MouseMove(object sender, MouseEventArgs e)
{
if (F == true)
{
W_ = e.Y;
H_ = e.X;
rez = Math.Sqrt((W_ - W)*(W_ - W) + (H_ - H)*(H_ - H));
Math.Round(rez);
}
/* else
{
rez =(int) Math.Sqrt((e.X * e.X - 2 * W * e.X + W * W) + (e.Y * e.Y - 2 * H * e.Y + H * H));
text = Convert.ToString(rez);
}*/
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
====================================
|