forked from yaunqiying/EasyCharts
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathForm_ChartSize_Save.cs
74 lines (60 loc) · 2.39 KB
/
Form_ChartSize_Save.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
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;
using Excel = Microsoft.Office.Interop.Excel;
using Office = Microsoft.Office.Core;
using Microsoft.Office.Tools.Excel;
namespace ExcelAddIn_Graphics
{
public partial class Form_ChartSize : Form
{
public Microsoft.Office.Tools.Excel.Worksheet worksheet;
public Excel.Chart chart;
public Form_ChartSize()
{
InitializeComponent();
}
private void Form_ChartSize_Load(object sender, EventArgs e)
{
try
{
worksheet = Globals.Factory.GetVstoObject(Globals.ThisAddIn.Application.ActiveWorkbook.ActiveSheet);
chart = Globals.ThisAddIn.Application.ActiveChart;
textBox_ChartHeight.Text = Convert.ToString(Math.Ceiling(chart.ChartArea.Height));
textBox_ChartWidth.Text = Convert.ToString(Math.Ceiling(chart.ChartArea.Width));
textBox_PlotAreaHeight.Text = Convert.ToString(Math.Ceiling(chart.PlotArea.Height));
textBox_PlotAreaWidth.Text = Convert.ToString(Math.Ceiling(chart.PlotArea.Width));
}
catch (Exception ee)
{
throw new Exception(ee.ToString());
}
}
//private void textBox_ChartHeight_TextChanged(object sender, EventArgs e)
//{
// if (textBox_ChartHeight.Text == "") return;
// chart.ChartArea.Height = double.Parse(textBox_ChartHeight.Text); ;
// //if (ratio == 0) return;
//}
private void button_OK_Click(object sender, EventArgs e)
{
if (textBox_ChartHeight.Text == "") return;
chart.ChartArea.Height = double.Parse(textBox_ChartHeight.Text);
if (textBox_ChartWidth.Text == "") return;
chart.ChartArea.Width = double.Parse(textBox_ChartWidth.Text);
if (textBox_PlotAreaHeight.Text == "") return;
chart.PlotArea.Height = double.Parse(textBox_PlotAreaHeight.Text);
if (textBox_PlotAreaWidth.Text == "") return;
chart.PlotArea.Width = double.Parse(textBox_PlotAreaWidth.Text);
//this.Close();
if (checkBox_AllChart.ThreeState==true)
{
}
}
}
}