-
Notifications
You must be signed in to change notification settings - Fork 0
/
FormGraph.cs
84 lines (77 loc) · 3.23 KB
/
FormGraph.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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 raytraicing
{
public partial class FormGraph : Form
{
public FormGraph()
{
InitializeComponent();
}
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
}
private void pictureBox1_Click(object sender, EventArgs e)
{
}
private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
{
//if (e.Button.Equals(MouseButtons.Middle)) MessageBox.Show(e.Location.ToString());
if (e.Button.Equals(MouseButtons.Middle))
{
(Owner as Form1).ShowT_Click(sender, e);
//MessageBox.Show("Инженерное RТ=" + (-0.128 * (Owner as Form1).Area / ((Owner as Form1).Perimetr * Math.Log(1 - (Owner as Form1).Alpha))).ToString() + "\n Программное RТ=" + (Owner as Form1).RT.ToString());
}
if (e.Button.Equals(MouseButtons.Left)) this.Close();
if (e.Button.Equals(MouseButtons.Right))
{
SaveFileDialog savedialog = new SaveFileDialog();
savedialog.Title = "Сохранить картинку как ...";
savedialog.OverwritePrompt = true;
savedialog.CheckPathExists = true;
savedialog.Filter =
"Bitmap File(*.bmp)|*.bmp|" +
"GIF File(*.gif)|*.gif|" +
"JPEG File(*.jpg)|*.jpg|" +
"TIF File(*.tif)|*.tif|" +
"PNG File(*.png)|*.png";
savedialog.ShowHelp = true;
if (savedialog.ShowDialog() == DialogResult.OK)
{
string strFilExtn = savedialog.FileName.Remove(0, savedialog.FileName.Length - 3);
switch (strFilExtn)
{
case "bmp":
pictureBox1.Image.Save(savedialog.FileName, System.Drawing.Imaging.ImageFormat.Bmp);
break;
case "jpg":
pictureBox1.Image.Save(savedialog.FileName, System.Drawing.Imaging.ImageFormat.Jpeg);
break;
case "gif":
pictureBox1.Image.Save(savedialog.FileName, System.Drawing.Imaging.ImageFormat.Gif);
break;
case "tif":
pictureBox1.Image.Save(savedialog.FileName, System.Drawing.Imaging.ImageFormat.Tiff);
break;
case "png":
pictureBox1.Image.Save(savedialog.FileName, System.Drawing.Imaging.ImageFormat.Png);
break;
default:
break;
}
}
}
}
private void FormGraph_Paint(object sender, PaintEventArgs e)
{
pictureBox1.Image = (Owner as Form1).Graph_bmp;
pictureBox1.Refresh();
}
}
}