PanelGroup.cs
5.15 KB
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Office.Interop.PowerPoint;
using GeneralLib;
namespace SunVoteARSPPT
{
public partial class PanelGroup : UserControl, IPanel, IPanelChange
{
TagSet mTagSet = null;
public TagSet TagSet
{
get { return mTagSet; }
set
{
mTagSet = value;
ucKeypadPara.TagSet = value;
ucResponsePara.TagSet = value;//杨斌 2015-04-10
}
}
public PanelGroup()
{
InitializeComponent();
nudOptionCount.Maximum = nudOptionCount.Maximum = GlobalInfo.MaxOptionCountAdv;//杨斌 2018-10-16
FrmSystemSet.LanguageSetEvent += new FrmSystemSet.LanguageSetEventHander(FrmSystemSet_LanguageSetEvent);
FrmVoteBar.PanelEnabledEvent += new FrmVoteBar.PanelEnabledEventHander(FrmVoteBar_PanelEnabledEvent);
gbxChoise.Resize += gbxChoise_Resize;
//设置控件大小
//杨斌 2015-04-10
ucResponsePara.ShowSet(false, false);
ucKeypadPara.Top = ucResponsePara.Bottom + 6;
this.Height = ucKeypadPara.Bottom;
GlobalInfo.SysLanguage.SetLanguage(this.Name, this);
//杨斌 2012-06-11
switch (GlobalInfo.OEMLogo)
{
case OEMLogos.oem3eAnalyzer:
//ucKeypadPara.Visible = false;
//if (ucKeypadPara.cboSubmitMode.SelectedIndex != 0)
// ucKeypadPara.cboSubmitMode.SelectedIndex = 0;
//this.Height = gbxChoise.Bottom;
break;
case OEMLogos.SunVote:
default:
break;
}
}
void gbxChoise_Resize(object sender, EventArgs e)
{
int pos = gbxChoise.ClientSize.Width / 2;
int w = pos - 3;
nudOptionCount.Left = pos;
//nudOptionCount.Width = w;
txtGroupName.Left = pos;
txtGroupName.Width = w;
}
void FrmVoteBar_PanelEnabledEvent(bool enabled)
{
this.Enabled = enabled;
}
void FrmSystemSet_LanguageSetEvent()
{
GlobalInfo.SysLanguage.SetLanguage(this.Name, this);
}
private void btnChartSet_Click(object sender, EventArgs e)
{
new FrmChartSet().ShowDialog();
}
public Color PanelColor
{
get
{
return this.BackColor;
}
set
{
this.BackColor = value;
gbxChoise.BackColor = value;
}
}
private void btnOptionText_Click(object sender, EventArgs e)
{
new FrmOptionTextSelect().ShowDialog();//杨斌 2013-01-24
}
/// <summary>
/// 加载参数面板数据
/// </summary>
public void LoadData()
{
ucResponsePara.LoadData();//杨斌 2015-04-10
ucKeypadPara.LoadData();
ControlOper.TrySetNumericUpDownValue(nudOptionCount, TagSet.LoadValue(TagKey.Group_OptionCount, nudOptionCount.Value).ToInt);
txtGroupName.Text = TagSet.LoadValue(TagKey.Slide_GroupName, "Group Name").Value;
}
private void nudOptionCount_ValueChanged(object sender, EventArgs e)
{
//2012-06-08 选项个数改变时需要重新设置图表高度
Globals.SunVoteARSAddIn.PPTEdit.CountChange = true;
TagSet.SetValue(TagKey.Group_OptionCount, nudOptionCount.Value);
//修改标志 2012-05-2 赵丽 保存当前图表的位置
PPTOper.SaveChartPosition(Globals.SunVoteARSAddIn.PPTEdit.SlideEdit, TagSet);
if (!Globals.SunVoteARSAddIn.PPTEdit.LockOptionTextChange)//判断是否选项文本在修改,杨斌 2012-03-05
{
Globals.SunVoteARSAddIn.PPTEdit.ModifyOptionText(Convert.ToInt32(nudOptionCount.Value));
}
//2012-11-21 数据字体根据选项个数变化 赵丽
PPTOper.SetFontSize(Convert.ToInt32(nudOptionCount.Value), TagSet);
Globals.SunVoteARSAddIn.PPTEdit.InitChart(true, Globals.SunVoteARSAddIn.PPTEdit.SlideEdit, autoFit: true);
//Globals.SunVoteARSAddIn.PPTEdit.UpdateChart();
}
public void ChangeData(TagKey tagKey, object value)
{
if (tagKey == TagKey.Group_OptionCount)
ControlOper.TrySetNumericUpDownValue(nudOptionCount, TagSet.LoadValue(tagKey, nudOptionCount.Value).ToInt);
if (tagKey == TagKey.Slide_GroupName)
txtGroupName.Text = value.ToString();
}
private void PanelGroup_Load(object sender, EventArgs e)
{
GlobalInfo.SysLanguage.SetLanguage(this.Name, this);
}
private void txtGroupName_TextChanged(object sender, EventArgs e)
{
TagSet.SetValue(TagKey.Slide_GroupName, txtGroupName.Text);
}
}
}