/
Report.cs
112 lines (95 loc) · 3.33 KB
/
Report.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace VISAP商科应用
{
public partial class Report : Form
{
public static Report ReportText = null;
public Report()
{
InitializeComponent();
ReportText = this;
MainForm.S.ReportIsOn = 1;
//打开开关,表示Report窗口已经被打开
richTextBox1.Rtf = MainForm.S.rtb.Rtf;
}
private void 打开ToolStripMenuItem_Click(object sender, EventArgs e)
{
ReportV.ImportFile(richTextBox1);
}
private void 保存ToolStripMenuItem_Click(object sender, EventArgs e)
{
ReportV.ExportFiles(richTextBox1);
}
private void 蓝色ToolStripMenuItem_Click(object sender, EventArgs e)
{
richTextBox1.SelectionColor = Color.Blue;
}
private void 红色ToolStripMenuItem_Click(object sender, EventArgs e)
{
richTextBox1.SelectionColor = Color.Red;
}
private void 绿色ToolStripMenuItem_Click(object sender, EventArgs e)
{
richTextBox1.SelectionColor = Color.Green;
}
private void 自定义颜色ToolStripMenuItem_Click(object sender, EventArgs e)
{
ColorDialog ChooseColor = new ColorDialog();
if (ChooseColor.ShowDialog() == DialogResult.OK)
{
richTextBox1.SelectionColor = ChooseColor.Color;
}
}
private void 粗体ToolStripMenuItem_Click(object sender, EventArgs e)
{
ReportV.ChangeFontStyle(FontStyle.Bold,richTextBox1);
}
private void 斜体ToolStripMenuItem_Click(object sender, EventArgs e)
{
ReportV.ChangeFontStyle(FontStyle.Italic, richTextBox1);
}
private void 下划线ToolStripMenuItem_Click(object sender, EventArgs e)
{
ReportV.ChangeFontStyle(FontStyle.Underline, richTextBox1);
}
private void Report_Load(object sender, EventArgs e)
{
}
private void Report_FormClosed(object sender, FormClosedEventArgs e)
{
//窗体关闭时将内容保存至父窗体
MainForm.S.rtb.Rtf = richTextBox1.Rtf;
MainForm.S.ReportIsOn = 0;
//将开关关闭
}
private void 左对齐ToolStripMenuItem_Click(object sender, EventArgs e)
{
richTextBox1.SelectionAlignment = HorizontalAlignment.Left;
}
private void 居中ToolStripMenuItem_Click(object sender, EventArgs e)
{
richTextBox1.SelectionAlignment = HorizontalAlignment.Center;
}
private void 右对齐ToolStripMenuItem_Click(object sender, EventArgs e)
{
richTextBox1.SelectionAlignment = HorizontalAlignment.Right;
}
private void 字体格式ToolStripMenuItem1_Click(object sender, EventArgs e)
{
FontDialog ChooseFont = new FontDialog();
if (ChooseFont.ShowDialog() == DialogResult.OK)
{
richTextBox1.SelectionFont = ChooseFont.Font;
}
}
}
}